Package com.saxonica.ee.schema
Class UserAtomicType
- java.lang.Object
- 
- com.saxonica.ee.schema.SchemaStructure
- 
- com.saxonica.ee.schema.UserDefinedType
- 
- com.saxonica.ee.schema.UserSimpleType
- 
- com.saxonica.ee.schema.UserAtomicType
 
 
 
 
- 
- All Implemented Interfaces:
- SerializableSchemaComponent,- UserSchemaComponent,- javax.xml.transform.SourceLocator,- Location,- AtomicType,- CastingTarget,- HyperType,- ItemType,- PlainType,- SchemaComponent,- SchemaType,- SimpleType,- org.xml.sax.Locator
 
 public class UserAtomicType extends UserSimpleType implements AtomicType An object belonging to this class represents an atomic type: either a built-in atomic type, or a user-defined atomic type. There is at most one AtomicType object for each distinct type in the schema (so equality can safely be tested using the == operator).
- 
- 
Field Summary- 
Fields inherited from class com.saxonica.ee.schema.UserDefinedTypeextendedTypes, finalProhibitions
 
- 
 - 
Constructor SummaryConstructors Constructor Description UserAtomicType(EnterpriseConfiguration config)Create a UserAtomicType
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicTypegetAtomizedItemType()Get the item type of the atomic values that will be produced when an item of this type is atomizedjava.lang.StringgetBasicAlphaCode()Get an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived.java.util.List<? extends PlainType>getPlainMemberTypes()Get the set of atomic types that are subsumed by this typeAtomicTypegetPrimitiveItemType()Get the primitive type from which this type is derived.intgetPrimitiveType()Get the primitive type from which this type is derived.java.lang.StringgetSharedInstance(java.lang.String value)Get an instance of the facet value that is stored in the schema rather than the instanceStringConvertergetStringConverter(ConversionRules rules)Get a StringConverter, an object which converts strings in the lexical space of this data type to instances (in the value space) of the data type.AtomicValuegetTypedValue(UnicodeString value, NamespaceResolver resolver, ConversionRules rules)Get the typed value corresponding to a given string value, assuming it is valid against this typeUTypegetUType()Get the correspondingUType.inthashCode()Returns a hash code value for the object.booleanisAbstract()Determine whether the type is abstract, that is, whether it cannot have instances that are not also instances of some concrete subtypebooleanisAtomicType()Test whether this Simple Type is an atomic typebooleanisAtomizable(TypeHierarchy th)Ask whether values of this type are atomizablebooleanisBuiltInType()Determine whether this is a built-in type or a user-defined typebooleanisCompilable()Ask whether it is possible to generate bytecode to perform validation against this atomic typebooleanisIdRefType()Ask whether this type is an IDREF or IDREFS type.booleanisIdType()Ask whether this type is an ID type.booleanisNamespaceSensitive()Test whether this simple type is namespace-sensitive, that is, whether it is derived from xs:QName or xs:NOTATIONbooleanisOrdered(boolean optimistic)Determine whether the atomic type is ordered, that is, whether less-than and greater-than comparisons are permittedbooleanisPlainType()Ask whether this is a plain type (a type whose instances are always atomic values)booleanisPrimitiveType()Determine whether the atomic type is a primitive type.booleanmatches(Item item, TypeHierarchy th)Test whether a given item conforms to this typeprotected voidserializeVariety(SchemaModelSerializer serializer)Serialize the schema componentjava.lang.StringtoExportString()Return a string representation of this ItemType suitable for use in stylesheet export files.java.lang.StringtoString()Produce a string representation of the type name.booleanvalidate(SchemaCompiler compiler)Checks the validity of this SimpleType definition.ValidationFailurevalidate(AtomicValue primValue, UnicodeString lexicalValue, ConversionRules rules)Validate that a primitive atomic value is a valid instance of a type derived from the same primitive type.ValidationFailurevalidateContent(UnicodeString value, NamespaceResolver nsResolver, ConversionRules rules)Check whether a given input string is valid according to this SimpleType- 
Methods inherited from class com.saxonica.ee.schema.UserSimpleTypeaddFacet, addInheritedFacets, analyzeContentExpression, applyWhitespaceNormalization, atomize, checkAgainstFacets, checkTypeDerivationIsOK, convertFacetValues, elaborate, getBuiltInBaseType, getComponentAsFunction, getComponentAsFunction, getContextComponent, getEQName, getExtendedFacetList, getFacet, getLocalFacetList, getWhitespaceAction, isListType, isSimpleType, isTypeDerivationOK, isUnionType, makeValidationFailure, mergeEnumerationFacets, postprocess, preprocess, serialize, setContextComponent, setFacetList
 - 
Methods inherited from class com.saxonica.ee.schema.UserDefinedTypeallowsDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBaseTypeReference, getBlock, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getExtensionTypes, getFinalProhibitions, getFingerprint, getName, getNamePool, getStructuredQName, getTargetNamespace, getTypeName, isAnonymousType, isComplexType, isSameType, isSameURI, registerExtensionType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setExtendedTypes, setFinalProhibitions, setTypeName
 - 
Methods inherited from class com.saxonica.ee.schema.SchemaStructurefixup, getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface net.sf.saxon.type.AtomicTypeexplainMismatch, getDefaultPriority, getGenre, getPrimitiveAtomicType, getTypeName
 - 
Methods inherited from interface net.sf.saxon.type.ItemTypegetFullAlphaCode, getNormalizedDefaultPriority
 - 
Methods inherited from interface net.sf.saxon.type.SchemaComponentgetComponentAsFunction, getRedefinitionLevel, getValidationStatus
 - 
Methods inherited from interface net.sf.saxon.type.SchemaTypeallowsDerivation, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getEQName, getFinalProhibitions, getFingerprint, getName, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType, isSimpleType
 - 
Methods inherited from interface net.sf.saxon.type.SimpleTypegetBuiltInBaseType, getWhitespaceAction, isListType, isUnionType, postprocess, preprocess
 - 
Methods inherited from interface com.saxonica.ee.schema.UserSchemaComponentfixup, lookForCycles
 
- 
 
- 
- 
- 
Constructor Detail- 
UserAtomicTypepublic UserAtomicType(EnterpriseConfiguration config) Create a UserAtomicType- Parameters:
- config- the Saxon configuration
 
 
- 
 - 
Method Detail- 
isAtomicTypepublic boolean isAtomicType() Test whether this Simple Type is an atomic type- Specified by:
- isAtomicTypein interface- ItemType
- Specified by:
- isAtomicTypein interface- SchemaType
- Specified by:
- isAtomicTypein interface- SimpleType
- Overrides:
- isAtomicTypein class- UserSimpleType
- Returns:
- true, this is an atomic type
 
 - 
isPlainTypepublic boolean isPlainType() Ask whether this is a plain type (a type whose instances are always atomic values)- Specified by:
- isPlainTypein interface- ItemType
- Returns:
- true
 
 - 
isIdTypepublic boolean isIdType() Ask whether this type is an ID type. This is defined to be any simple type who typed value may contain atomic values of type xs:ID: that is, it includes types derived from ID by restriction, list, or union. Note that for a node to be treated as an ID, its typed value must be a *single* atomic value of type ID; the type of the node, however, can still allow a list.- Specified by:
- isIdTypein interface- AtomicType
- Specified by:
- isIdTypein interface- SchemaType
- Overrides:
- isIdTypein class- UserSimpleType
- Returns:
- true if this type is an ID type
 
 - 
isIdRefTypepublic boolean isIdRefType() throws MissingComponentExceptionAsk whether this type is an IDREF or IDREFS type. This is defined to be any simple type who typed value may contain atomic values of type xs:IDREF: that is, it includes types derived from IDREF or IDREFS by restriction, list, or union- Specified by:
- isIdRefTypein interface- AtomicType
- Specified by:
- isIdRefTypein interface- SchemaType
- Overrides:
- isIdRefTypein class- UserSimpleType
- Returns:
- true if this type is an IDREF type
- Throws:
- MissingComponentException
 
 - 
isBuiltInTypepublic boolean isBuiltInType() Determine whether this is a built-in type or a user-defined type- Specified by:
- isBuiltInTypein interface- AtomicType
- Specified by:
- isBuiltInTypein interface- SimpleType
- Returns:
- true if this is a built-in type
 
 - 
getBasicAlphaCodepublic java.lang.String getBasicAlphaCode() Get an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived. The codes are designed so that for any two built-in types A and B, alphaCode(A) is a prefix of alphaCode(B) if and only if A is a supertype of B.- Specified by:
- getBasicAlphaCodein interface- ItemType
- Returns:
- the alphacode for the nearest containing built-in type
 
 - 
isPrimitiveTypepublic boolean isPrimitiveType() Determine whether the atomic type is a primitive type. The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration; xs:untypedAtomic; and all supertypes of these (xs:anyAtomicType, xs:numeric, ...)- Specified by:
- isPrimitiveTypein interface- AtomicType
- Returns:
- true if the type is considered primitive under the above rules
 
 - 
getUTypepublic UType getUType() Get the correspondingUType. A UType is a union of primitive item types.
 - 
isOrderedpublic boolean isOrdered(boolean optimistic) Determine whether the atomic type is ordered, that is, whether less-than and greater-than comparisons are permitted- Specified by:
- isOrderedin interface- AtomicType
- Parameters:
- optimistic- if true, the function takes an optimistic view, returning true if ordering comparisons are available for some subtype. This mainly affects xs:duration, where the function returns true if optimistic is true, false if it is false.
- Returns:
- true if ordering operations are permitted
 
 - 
isAbstractpublic boolean isAbstract() Determine whether the type is abstract, that is, whether it cannot have instances that are not also instances of some concrete subtype- Specified by:
- isAbstractin interface- AtomicType
- Returns:
- false (always)
 
 - 
getStringConverterpublic StringConverter getStringConverter(ConversionRules rules) Get a StringConverter, an object which converts strings in the lexical space of this data type to instances (in the value space) of the data type.- Specified by:
- getStringConverterin interface- AtomicType
- Parameters:
- rules- the conversion rules to be used
- Returns:
- a StringConverter to do the conversion, or null if no built-in converter is available.
 
 - 
validatepublic boolean validate(SchemaCompiler compiler) throws SchemaException Checks the validity of this SimpleType definition.- Specified by:
- validatein interface- UserSchemaComponent
- Overrides:
- validatein class- UserSimpleType
- Parameters:
- compiler- used for error reporting
- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
- SchemaException- when this SimpleType definition is invalid.
 
 - 
matchespublic boolean matches(Item item, TypeHierarchy th) Test whether a given item conforms to this type
 - 
isCompilablepublic boolean isCompilable() Ask whether it is possible to generate bytecode to perform validation against this atomic type- Returns:
- true if bytecode generation is possible
 
 - 
validateContentpublic ValidationFailure validateContent(UnicodeString value, NamespaceResolver nsResolver, ConversionRules rules) Check whether a given input string is valid according to this SimpleType- Specified by:
- validateContentin interface- SimpleType
- Parameters:
- value- the input string to be checked
- nsResolver- a namespace resolver used to resolve namespace prefixes if the type is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive content will throw an UnsupportedOperationException.
- rules- the conversion rules for this Configuration
- Returns:
- null if validation succeeds; return a ValidationFailure describing the validation failure if validation fails.
- Throws:
- java.lang.UnsupportedOperationException- if the type is namespace-sensitive and no namespace resolver is supplied
 
 - 
getTypedValuepublic AtomicValue getTypedValue(UnicodeString value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException Get the typed value corresponding to a given string value, assuming it is valid against this type- Specified by:
- getTypedValuein interface- SimpleType
- Parameters:
- value- the string value
- resolver- the namespace resolver
- rules- the conversion rules for the Saxon configuration
- Returns:
- an iterator over the atomic sequence comprising the typed value
- Throws:
- ValidationException- if the supplied value is not in the lexical space of the data type
 
 - 
getPrimitiveItemTypepublic AtomicType getPrimitiveItemType() Get the primitive type from which this type is derived. For the definition of primitive types, seeType.isPrimitiveAtomicType(int)- Specified by:
- getPrimitiveItemTypein interface- ItemType
- Specified by:
- getPrimitiveItemTypein interface- PlainType
- Returns:
- the type code of the primitive type
 
 - 
getPrimitiveTypepublic int getPrimitiveType() Get the primitive type from which this type is derived. For the definition of primitive types, seeType.isPrimitiveAtomicType(int)- Specified by:
- getPrimitiveTypein interface- ItemType
- Returns:
- the type code of the primitive type
 
 - 
isNamespaceSensitivepublic boolean isNamespaceSensitive() Test whether this simple type is namespace-sensitive, that is, whether it is derived from xs:QName or xs:NOTATION- Specified by:
- isNamespaceSensitivein interface- HyperType
- Returns:
- true if this type is derived from xs:QName or xs:NOTATION
 
 - 
getAtomizedItemTypepublic AtomicType getAtomizedItemType() Get the item type of the atomic values that will be produced when an item of this type is atomized- Specified by:
- getAtomizedItemTypein interface- ItemType
- Returns:
- the best available item type of the atomic values that will be produced when an item of this type is atomized, or null if it is known that atomization will throw an error.
 
 - 
isAtomizablepublic boolean isAtomizable(TypeHierarchy th) Ask whether values of this type are atomizable- Specified by:
- isAtomizablein interface- ItemType
- Parameters:
- th- The type hierarchy cache
- Returns:
- true unless it is known that these items will be elements with element-only content, in which case return false
 
 - 
getSharedInstancepublic java.lang.String getSharedInstance(java.lang.String value) Get an instance of the facet value that is stored in the schema rather than the instance- Parameters:
- value- the value required
- Returns:
- a string which is equal to the value required, but which if possible is the instance held in the compiled schema, reducing storage requirements in instances.
 
 - 
toStringpublic java.lang.String toString() Produce a string representation of the type name. If the type is anonymous, an internally-allocated type name will be returned.- Overrides:
- toStringin class- UserDefinedType
- Returns:
- the name of the atomic type in the form Q{uri}local
 
 - 
toExportStringpublic java.lang.String toExportString() Return a string representation of this ItemType suitable for use in stylesheet export files. This differs from the result of toString() in that it will not contain any references to anonymous types. Note that it may also use the Saxon extended syntax for union types and tuple types. The default implementation returns the result of callingtoString().- Specified by:
- toExportStringin interface- ItemType
- Returns:
- the string representation as an instance of the XPath SequenceType construct
 
 - 
hashCodepublic int hashCode() Returns a hash code value for the object.- Overrides:
- hashCodein class- java.lang.Object
 
 - 
validatepublic ValidationFailure validate(AtomicValue primValue, UnicodeString lexicalValue, ConversionRules rules) Validate that a primitive atomic value is a valid instance of a type derived from the same primitive type.- Specified by:
- validatein interface- AtomicType
- Parameters:
- primValue- the value in the value space of the primitive type.
- lexicalValue- the value in the lexical space. If null, the string value of primValue is used. This value is checked against the pattern facet (if any)
- rules- the conversion rules used for this configuration
- Returns:
- null if the value is valid; otherwise, a ValidationFailure object indicating the nature of the error.
- Throws:
- java.lang.UnsupportedOperationException- in the case of an external object type
 
 - 
serializeVarietyprotected void serializeVariety(SchemaModelSerializer serializer) throws XPathException Serialize the schema component- Specified by:
- serializeVarietyin class- UserSimpleType
- Throws:
- XPathException
 
 - 
getPlainMemberTypespublic java.util.List<? extends PlainType> getPlainMemberTypes() Get the set of atomic types that are subsumed by this type- Specified by:
- getPlainMemberTypesin interface- PlainType
- Returns:
- for an atomic type, the type itself; for a union type, the set of atomic types in its transitive membership
 
 
- 
 
-