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.SimpleType
FINAL_ALL, FINAL_LIST, FINAL_RESTRICTION, FINAL_UNION
 
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
 Facet getMax()
          Gets the MAX_INCLUSIVE facet or the MAX_EXCLUSIVE facet (both are never defined at the same time) returns null if there is no maximum
 Facet getMin()
          Gets the MIN_INCLUSIVE facet or the MIN_EXCLUSIVE facet (both are never defined at the same time) returns null if there is no minimum
 java.lang.String getPattern()
          Gets the pattern facet returns null if there is none
 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)
          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 isMaxInclusive()
          Tells if the maximum is inclusive or not Has no meaning if there is no maxInclusive/Exclusive facet
 boolean isMinInclusive()
          Tells if the minimum is inclusive or not Has no meaning if there is no minInclusive/Exclusive facet
 boolean isSameType(ItemType other)
          Test whether this is 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
 void validateContent(java.lang.CharSequence value, NamespaceResolver namespaceResolver)
          Check whether a given input string is valid according to this SimpleType
 
Methods inherited from class net.sf.saxon.type.SimpleType
addFacet, getBuiltInBaseType, getFacet, getFacetList, getFacets, getFacets, getLocalFacets, getTypedValue, isListType, isNamespaceSensitive, isSimpleType, setFacets, validate
 
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, isValidRestriction, setBaseType, setBaseTypeFingerprint, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setFinal, 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


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 namespaceResolver)
                     throws ValidationException
Check whether a given input string is valid according to this SimpleType

Specified by:
validateContent in class SimpleType
Throws:
ValidationException - if the value is not valid

getTypedValue

public SequenceIterator getTypedValue(java.lang.CharSequence value)
                               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
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

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

getPattern

public java.lang.String getPattern()
Gets the pattern facet returns null if there is none


isMinInclusive

public boolean isMinInclusive()
Tells if the minimum is inclusive or not Has no meaning if there is no minInclusive/Exclusive facet


isMaxInclusive

public boolean isMaxInclusive()
Tells if the maximum is inclusive or not Has no meaning if there is no maxInclusive/Exclusive facet


getMin

public Facet getMin()
Gets the MIN_INCLUSIVE facet or the MIN_EXCLUSIVE facet (both are never defined at the same time) returns null if there is no minimum


getMax

public Facet getMax()
Gets the MAX_INCLUSIVE facet or the MAX_EXCLUSIVE facet (both are never defined at the same time) returns null if there is no maximum


isSameType

public boolean isSameType(ItemType other)
Description copied from interface: ItemType
Test whether this is the same type as another ItemType. Following stylesheet compilation, comparing the objects for Java identity doesn't work

Specified by:
isSameType in interface ItemType