net.sf.saxon.type
Class AtomicType

java.lang.Object
  |
  +--net.sf.saxon.type.SchemaType
        |
        +--net.sf.saxon.type.SimpleType
              |
              +--net.sf.saxon.type.AtomicType
All Implemented Interfaces:
ItemType, java.io.Serializable, javax.xml.transform.SourceLocator
Direct Known Subclasses:
ExternalObjectType

public class AtomicType
extends SimpleType
implements ItemType

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).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.type.SchemaType
ALL_DERIVATIONS, DERIVE_BY_EXTENSION, DERIVE_BY_LIST, DERIVE_BY_RESTRICTION, DERIVE_BY_SUBSTITUTION, DERIVE_BY_UNION, finalProhibitions, INVALID, UNVALIDATED, VALIDATED, VALIDATING, validationPhase
 
Constructor Summary
AtomicType()
           
 
Method Summary
 AtomicType getAtomizedItemType()
          Get the item type of the atomic values that will be produced when an item of this type is atomized
 int getPrimitiveType()
          Get the primitive type from which this type is derived.
 ItemType getSuperType()
          Get the type from which this item type is derived by restriction.
 SequenceIterator getTypedValue(java.lang.CharSequence value, NodeInfo node)
          Get the typed value corresponding to a given string value, assuming it is valid against this type
 boolean isBuiltIn()
          Test whether this is a built-in type
 boolean isSameType(ItemType other)
          Determine whether this AtomicType represents the same type as another ItemType
 boolean matchesItem(Item item)
          Test whether a given item conforms to this type
 void setIsBuiltIn(boolean yesOrNo)
          Mark this as a built-in type
 java.lang.String toString()
          Produce string representation for use in diagnostic output
 boolean validate(SchemaMarker schema)
          Checks the validity of this SimpleType definition.
 void validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver)
          Check whether a given input string is valid according to this SimpleType
 
Methods inherited from class net.sf.saxon.type.SimpleType
applyWhitespaceNormalization, getBuiltInBaseType, getFacet, getFacetCollection, getFacets, getFacets, getTypedValue, getWhitespaceAction, isListType, isNamespaceSensitive, isSimpleType, isTypeDerivationOK, isUnionType, iterateMemberTypes, setFacetCollection
 
Methods inherited from class net.sf.saxon.type.SchemaType
allowsDerivation, checkDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBlock, getColumnNumber, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLineNumber, getLocalName, getNamePool, getPublicId, getSystemId, isComplexType, setBaseType, setBaseTypeFingerprint, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setFinalProhibitions, setFingerprint, setLineNumber, setLocalName, setLocator, setNamePool, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomicType

public AtomicType()
Method Detail

setIsBuiltIn

public void setIsBuiltIn(boolean yesOrNo)
Mark this as a built-in type


isBuiltIn

public boolean isBuiltIn()
Test whether this is a built-in type


validate

public boolean validate(SchemaMarker schema)
                 throws javax.xml.transform.TransformerException
Checks the validity of this SimpleType definition.

Overrides:
validate in class SimpleType
Parameters:
schema - a Schema used for error reporting
Throws:
javax.xml.transform.TransformerException - when this SimpleType definition is invalid.

matchesItem

public boolean matchesItem(Item item)
Test whether a given item conforms to this type

Specified by:
matchesItem in interface ItemType
Parameters:
item - The item to be tested
Returns:
true if the item is an instance of this type; false otherwise

validateContent

public void validateContent(java.lang.CharSequence value,
                            NamespaceResolver nsResolver)
                     throws ValidationException
Check whether a given input string is valid according to this SimpleType

Specified by:
validateContent in class 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.
Throws:
ValidationException - if the content is invalid
java.lang.UnsupportedOperationException - if the type is namespace-sensitive and no namespace resolver is supplied

getTypedValue

public SequenceIterator getTypedValue(java.lang.CharSequence value,
                                      NodeInfo node)
                               throws ValidationException
Get the typed value corresponding to a given string value, assuming it is valid against this type

Specified by:
getTypedValue in class SimpleType
Parameters:
value - the string value
node - the node containing the value, used to resolve namespace prefixes
Returns:
an iterator over the atomic sequence comprising the typed value
ValidationException

getSuperType

public ItemType getSuperType()
Get the type from which this item type is derived by restriction. This is the supertype in the XPath type heirarchy, as distinct from the Schema base type: this means that the supertype of xs:boolean is xdt:anyAtomicType, whose supertype is item() (rather than xs:anySimpleType).

Specified by:
getSuperType in interface ItemType
Returns:
the supertype, or null if this type is item()

getPrimitiveType

public int getPrimitiveType()
Get the primitive type from which this type is derived. For the definition of primitive types, see Type.isPrimitiveType(int)

Specified by:
getPrimitiveType in interface ItemType
Returns:
the type code of the primitive type

getAtomizedItemType

public AtomicType getAtomizedItemType()
Get the item type of the atomic values that will be produced when an item of this type is atomized

Specified by:
getAtomizedItemType in interface ItemType

toString

public java.lang.String toString()
Produce string representation for use in diagnostic output

Specified by:
toString in interface ItemType
Overrides:
toString in class java.lang.Object

isSameType

public boolean isSameType(ItemType other)
Determine whether this AtomicType represents the same type as another ItemType

Specified by:
isSameType in interface ItemType
Parameters:
other - the other type
Returns:
true if and only if both objects represent the same type