public abstract class Facet
extends java.lang.Object
Constructor and Description |
---|
Facet() |
Modifier and Type | Method and Description |
---|---|
void |
checkFacetRestriction(UserSimpleType type,
SimpleType base,
SchemaCompiler compiler)
Check that this facet is legal when used on a type derived by restriction
|
abstract Function |
getFacetAsFunctionItem()
Get a function item that represents this Facet schema component.
|
java.lang.String |
getMessage()
Get the message to be used when this facet is violated.
|
abstract java.lang.String |
getName()
Returns the name of this Facet
|
abstract java.lang.String |
getValue()
Returns the lexical representation of the value of this facet
|
int |
getWhitespaceAction()
Get the whitespace action required by this facet: one of PRESERVE, REPLACE, or COLLAPSE.
|
boolean |
isConstraining()
Ask whether this is a constraining facet (as distinct from a pre-lexical facet)
|
static boolean |
isFacetName(java.lang.String name,
int xsdVersion)
Test whether a given string is one of the recognized facet names
|
boolean |
isFixed()
Ask whether the facet is defined in the schema with fixed="true"
|
boolean |
isNewlyIntroduced(SimpleType base)
Test whether this facet is newly introduced on this type, that is, whether it is absent
from the base type
|
static Facet |
makeFacet(java.lang.String name,
java.lang.String value,
EnterpriseConfiguration config,
NamespaceResolver resolver,
SchemaCompiler compiler)
Factory method: creates a new Facet with the given name
|
void |
serializeFacet(SchemaModelSerializer serializer)
Serialize this facet when externalizing the schema component model
|
void |
setFixed(boolean fixed)
Say whether the facet is defined as fixed
|
void |
setMessage(java.lang.String message)
Set the message to be used when this facet is violated.
|
abstract boolean |
testAtomicValue(AtomicValue value)
Test whether an atomic value conforms to this facet
|
boolean |
testLength(int count)
Test whether the length of a list conforms to this facet.
|
boolean |
testListValue(AtomicSequence value)
Test whether a list value conforms to this facet.
|
long |
toLong()
Returns the numeric value of this facet, for facets where this is appropriate
|
public void setFixed(boolean fixed)
fixed
- true if the facet is fixedpublic boolean isFixed()
public boolean isConstraining()
public void setMessage(java.lang.String message)
message
- the message to be usedpublic java.lang.String getMessage()
public abstract java.lang.String getName()
public abstract java.lang.String getValue()
public long toLong() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- if the value is not numericpublic void checkFacetRestriction(UserSimpleType type, SimpleType base, SchemaCompiler compiler) throws SchemaException, ValidationException
type
- the type on which the facet is definedbase
- the type from which the restricted type is derivedcompiler
- the schema compilerSchemaException
- if the facet is not legalValidationException
- if a value is found that does not conform to the facetpublic boolean isNewlyIntroduced(SimpleType base)
base
- the base typepublic abstract boolean testAtomicValue(AtomicValue value)
value
- the value to be testedpublic boolean testListValue(AtomicSequence value)
value
- the value to be testedpublic boolean testLength(int count)
count
- the actual length of the listpublic int getWhitespaceAction()
public void serializeFacet(SchemaModelSerializer serializer) throws XPathException
serializer
- receives the content for serializationXPathException
- if an error occurs writing the value to the outputpublic static boolean isFacetName(java.lang.String name, int xsdVersion)
name
- a candidate facet name, for example "totalDigits"xsdVersion
- either XSD10 or XSD11public abstract Function getFacetAsFunctionItem()
public static Facet makeFacet(java.lang.String name, java.lang.String value, EnterpriseConfiguration config, NamespaceResolver resolver, SchemaCompiler compiler) throws SchemaException
name
- the name of the Facetvalue
- the value of the Facetconfig
- the Saxon configurationresolver
- a namespace resolver used for resolving prefixes in namespace-sensitive enumeration valuesSchemaException
- if an error is foundCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.