Interface XSDatatype
-
- All Superinterfaces:
DatabindableDatatype
,org.relaxng.datatype.Datatype
,java.io.Serializable
- All Known Implementing Classes:
AnyURIType
,Base64BinaryType
,BinaryBaseType
,BooleanType
,BuiltinAtomicType
,ByteType
,ConcreteType
,DataTypeWithFacet
,DataTypeWithLexicalConstraintFacet
,DataTypeWithValueConstraintFacet
,DateTimeBaseType
,DateTimeType
,DateType
,DoubleType
,DurationType
,EntityType
,EnumerationFacet
,ErrorType
,FinalComponent
,FloatingNumberType
,FloatType
,FractionDigitsFacet
,GDayType
,GMonthDayType
,GMonthType
,GYearMonthType
,GYearType
,HexBinaryType
,IDREFType
,IDType
,IntegerDerivedType
,IntegerType
,IntType
,LanguageType
,LengthFacet
,ListType
,LongType
,MaxExclusiveFacet
,MaxInclusiveFacet
,MaxLengthFacet
,MinExclusiveFacet
,MinInclusiveFacet
,MinLengthFacet
,NameType
,NcnameType
,NegativeIntegerType
,NmtokenType
,NonNegativeIntegerType
,NonPositiveIntegerType
,NormalizedStringType
,NumberType
,PatternFacet
,PositiveIntegerType
,Proxy
,QnameType
,RangeFacet
,ShortType
,SimpleURType
,StringType
,TimeType
,TokenType
,TotalDigitsFacet
,UnionType
,UnsignedByteType
,UnsignedIntType
,UnsignedLongType
,UnsignedShortType
,WhiteSpaceFacet
,XSDatatypeImpl
public interface XSDatatype extends java.io.Serializable, DatabindableDatatype
Publicly accesible interface of W3C XML Schema datatype (simple type).The most important methods are defined in the
org.relaxng.datatype.Datatype
interface. This interface provides additional information which is not covered byDatatype
interface. Also, this interface provides various simple type component properties which are defined in the spec.Application can use this interface to interact with datatype objects.
-
-
Field Summary
Fields Modifier and Type Field Description static int
APPLICABLE
indicates the specified facet is applicable to this type.static int
DERIVATION_BY_LIST
static int
DERIVATION_BY_RESTRICTION
static int
DERIVATION_BY_UNION
static java.lang.String
FACET_ENUMERATION
static java.lang.String
FACET_FRACTIONDIGITS
static java.lang.String
FACET_LENGTH
static java.lang.String
FACET_MAXEXCLUSIVE
static java.lang.String
FACET_MAXINCLUSIVE
static java.lang.String
FACET_MAXLENGTH
static java.lang.String
FACET_MINEXCLUSIVE
static java.lang.String
FACET_MININCLUSIVE
static java.lang.String
FACET_MINLENGTH
static java.lang.String
FACET_PATTERN
static java.lang.String
FACET_TOTALDIGITS
static java.lang.String
FACET_WHITESPACE
static int
FIXED
indicates the specified facet is fixed in this type and therefore not appliable.static int
NOT_ALLOWED
indicates the specified facet is not appliable to this type by definition.static int
VARIETY_ATOMIC
static int
VARIETY_LIST
static int
VARIETY_UNION
static java.lang.String
XMLSCHEMA_NSURI
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
convertToLexicalValue(java.lang.Object valueObject, SerializationContext context)
converts value object back to the corresponding value in the lexical space.java.lang.String
displayName()
gets the displayable name of this type.XSDatatype
getAncestorBuiltinType()
Gets the nearest ancestor built-in type.java.lang.String[]
getApplicableFacetNames()
Gets the names of all applicable facets.XSDatatype
getBaseType()
gets the base type of this type.DataTypeWithFacet
getFacetObject(java.lang.String facetName)
gets the facet object that restricts the specified facet.java.lang.String
getName()
gets the local name of the type.java.lang.String
getNamespaceUri()
Gets the namespace URI of this simple type definition.int
getVariety()
gets the variety of this simple type.boolean
isAlwaysValid()
Returns true if this datatype is known to accept any string.boolean
isDerivedTypeOf(XSDatatype baseType, boolean restrictionAllowed)
tests if this type is a derived type of the specified type.int
isFacetApplicable(java.lang.String facetName)
returns if the specified facet is applicable to this datatype.boolean
isFinal(int derivationType)
checks if this type is declared as final for the specified kind of derivation.-
Methods inherited from interface com.sun.msv.datatype.DatabindableDatatype
createJavaObject, getJavaObjectType, serializeJavaObject
-
-
-
-
Field Detail
-
VARIETY_ATOMIC
static final int VARIETY_ATOMIC
- See Also:
- Constant Field Values
-
VARIETY_LIST
static final int VARIETY_LIST
- See Also:
- Constant Field Values
-
VARIETY_UNION
static final int VARIETY_UNION
- See Also:
- Constant Field Values
-
DERIVATION_BY_RESTRICTION
static final int DERIVATION_BY_RESTRICTION
- See Also:
- Constant Field Values
-
DERIVATION_BY_LIST
static final int DERIVATION_BY_LIST
- See Also:
- Constant Field Values
-
DERIVATION_BY_UNION
static final int DERIVATION_BY_UNION
- See Also:
- Constant Field Values
-
APPLICABLE
static final int APPLICABLE
indicates the specified facet is applicable to this type. One of the possible return value from the isFacetApplicable method.- See Also:
- Constant Field Values
-
FIXED
static final int FIXED
indicates the specified facet is fixed in this type and therefore not appliable. One of the possible return value from the isFacetApplicable method.- See Also:
- Constant Field Values
-
NOT_ALLOWED
static final int NOT_ALLOWED
indicates the specified facet is not appliable to this type by definition. One of the possible return value from the isFacetApplicable method.- See Also:
- Constant Field Values
-
FACET_LENGTH
static final java.lang.String FACET_LENGTH
- See Also:
- Constant Field Values
-
FACET_MINLENGTH
static final java.lang.String FACET_MINLENGTH
- See Also:
- Constant Field Values
-
FACET_MAXLENGTH
static final java.lang.String FACET_MAXLENGTH
- See Also:
- Constant Field Values
-
FACET_PATTERN
static final java.lang.String FACET_PATTERN
- See Also:
- Constant Field Values
-
FACET_ENUMERATION
static final java.lang.String FACET_ENUMERATION
- See Also:
- Constant Field Values
-
FACET_TOTALDIGITS
static final java.lang.String FACET_TOTALDIGITS
- See Also:
- Constant Field Values
-
FACET_FRACTIONDIGITS
static final java.lang.String FACET_FRACTIONDIGITS
- See Also:
- Constant Field Values
-
FACET_MININCLUSIVE
static final java.lang.String FACET_MININCLUSIVE
- See Also:
- Constant Field Values
-
FACET_MAXINCLUSIVE
static final java.lang.String FACET_MAXINCLUSIVE
- See Also:
- Constant Field Values
-
FACET_MINEXCLUSIVE
static final java.lang.String FACET_MINEXCLUSIVE
- See Also:
- Constant Field Values
-
FACET_MAXEXCLUSIVE
static final java.lang.String FACET_MAXEXCLUSIVE
- See Also:
- Constant Field Values
-
FACET_WHITESPACE
static final java.lang.String FACET_WHITESPACE
- See Also:
- Constant Field Values
-
XMLSCHEMA_NSURI
static final java.lang.String XMLSCHEMA_NSURI
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
-
getNamespaceUri
java.lang.String getNamespaceUri()
Gets the namespace URI of this simple type definition.
-
displayName
java.lang.String displayName()
gets the displayable name of this type. This method always return something. It is useful to provide a message to the user.This method is an ad-hoc method and there is no corresponding property in the spec.
-
convertToLexicalValue
java.lang.String convertToLexicalValue(java.lang.Object valueObject, SerializationContext context) throws java.lang.IllegalArgumentException
converts value object back to the corresponding value in the lexical space.This method does the reverse operation of the createValue method. The returned string is not necessarily the canonical representation. Also note that the implementation may accept invalid values without throwing IllegalArgumentException. To make sure that the result is actually a valid representation, call the isValid method.
Be careful not to confuse this method with The serializeJavaObject method, which is defined in the
DatabindableDatatype
method.- Parameters:
context
- Context information that will be possibly used for the conversion. Currently, this object is used only by QName, but may be extended in the future.- Throws:
java.lang.IllegalArgumentException
- if the type of the given object is not the expected one. For example, this exception is thrown if you pass a BigInteger object to the "gYear" type.
-
getVariety
int getVariety()
gets the variety of this simple type.- Returns:
- VARIETY_ATOMIC, VARIETY_LIST, or VARIETY_UNION.
-
isFinal
boolean isFinal(int derivationType)
checks if this type is declared as final for the specified kind of derivation.In the terminology of the spec, this method can be used to examine the final property of this component.
- Parameters:
derivationType
- one of pre-defined values (DERIVATION_BY_XXX).
-
isFacetApplicable
int isFacetApplicable(java.lang.String facetName)
returns if the specified facet is applicable to this datatype.- Returns:
- APPLICABLE
- if the facet is applicable
- FIXED
- if the facet is already fixed (that is,not applicable)
- NOT_ALLOWED
- if the facet is not applicable to this datatype at all. this value is also returned for unknown facets.
-
getApplicableFacetNames
java.lang.String[] getApplicableFacetNames()
Gets the names of all applicable facets.
-
getFacetObject
DataTypeWithFacet getFacetObject(java.lang.String facetName)
gets the facet object that restricts the specified facet. This method can be used to access various details of how facets are applied to this datatype.- Returns:
- null if no such facet object exists.
-
getBaseType
XSDatatype getBaseType()
gets the base type of this type. This method returns null if this object represents the simple ur-type.This method is intended to capture the semantics of the base type definition property of the simple type component, but there is an important difference.
Specifically, if you derive a type D from another type B, then calling D.getBaseType() does not necessarily return B. Instead, it may return an intermediate object (that represents a facet). Calling the getBaseType method recursively will eventually return B.
-
getAncestorBuiltinType
XSDatatype getAncestorBuiltinType()
Gets the nearest ancestor built-in type.This method traverses the inheritance chain from this datatype to the root type (anySimpleType) and return the first built-in type it finds.
For example, if you derive a type Foo from NCName and Bar from Foo, then this method returns NCName.
- Returns:
- Always return non-null valid object.
-
isDerivedTypeOf
boolean isDerivedTypeOf(XSDatatype baseType, boolean restrictionAllowed)
tests if this type is a derived type of the specified type.This method is an implementation of "Type Derivation OK (Simple)" of the spec. Therefore use caution if what you want is a casual method because this method may cause a lot of unintuitive result.
Note to implementors Use the static version of this method defined in the XSDatatypeImpl class. You don't need to implement this method from scratch.
- Parameters:
restrictionAllowed
- This test needs "a subset of {extension,restriction,list,union} (of which only restriction is actually relevant). If this flag is set to true, this method behaves as if the empty set is passed as the set. This is usually what you want if you're simply trying to check the derivation relationship.If this flag is set to false, this method behaves as if {restriction} is passed as the set.
-
isAlwaysValid
boolean isAlwaysValid()
Returns true if this datatype is known to accept any string. This is just a hint that allows the client code to do certain optimization.This method can return false even if the datatype actually accepts any string. That is, it's perfectly OK for any datatype to return false from this method.
-
-