Class XSDatatypeImpl
- java.lang.Object
-
- com.sun.msv.datatype.xsd.XSDatatypeImpl
-
- All Implemented Interfaces:
DatabindableDatatype,XSDatatype,java.io.Serializable,org.relaxng.datatype.Datatype
- Direct Known Subclasses:
ConcreteType,DataTypeWithFacet,Proxy
public abstract class XSDatatypeImpl extends java.lang.Object implements XSDatatype
base implementaion for XSDatatype interface.This class should be considered as the implementation-detail, and applications should not access this class.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringERR_DUPLICATE_FACETstatic java.lang.StringERR_EMPTY_UNIONstatic java.lang.StringERR_ENUMERATIONstatic java.lang.StringERR_ENUMERATION_WITH_ARGstatic java.lang.StringERR_FACET_MUST_BE_NON_NEGATIVE_INTEGERstatic java.lang.StringERR_FACET_MUST_BE_POSITIVE_INTEGERstatic java.lang.StringERR_INAPPROPRIATE_FOR_TYPEstatic java.lang.StringERR_INCONSISTENT_FACETS_1static java.lang.StringERR_INCONSISTENT_FACETS_2static java.lang.StringERR_INVALID_BASE_TYPEstatic java.lang.StringERR_INVALID_ITEMTYPEstatic java.lang.StringERR_INVALID_MEMBER_TYPEstatic java.lang.StringERR_INVALID_VALUE_FOR_THIS_TYPEstatic java.lang.StringERR_INVALID_WHITESPACE_VALUEstatic java.lang.StringERR_LENGTHstatic java.lang.StringERR_LOOSENED_FACETstatic java.lang.StringERR_MAXLENGTHstatic java.lang.StringERR_MINLENGTHstatic java.lang.StringERR_NOT_APPLICABLE_FACETstatic java.lang.StringERR_OUT_OF_RANGEstatic java.lang.StringERR_OVERRIDING_FIXED_FACETstatic java.lang.StringERR_PARSE_ERRORstatic java.lang.StringERR_PATTERN_1static java.lang.StringERR_PATTERN_MANYstatic java.lang.StringERR_SCALE_IS_GREATER_THAN_PRECISIONstatic java.lang.StringERR_TOO_MUCH_PRECISIONstatic java.lang.StringERR_TOO_MUCH_SCALEstatic java.lang.StringERR_X_AND_Y_ARE_EXCLUSIVEprivate java.lang.StringnamespaceUriprotected static org.relaxng.datatype.ValidationContextserializedValueCheckerprivate static longserialVersionUIDprivate java.lang.StringtypeNameWhiteSpaceProcessorwhiteSpacethis field characterizes how this datatype treats white space.-
Fields inherited from interface org.relaxng.datatype.Datatype
ID_TYPE_ID, ID_TYPE_IDREF, ID_TYPE_IDREFS, ID_TYPE_NULL
-
Fields inherited from interface com.sun.msv.datatype.xsd.XSDatatype
APPLICABLE, DERIVATION_BY_LIST, DERIVATION_BY_RESTRICTION, DERIVATION_BY_UNION, FACET_ENUMERATION, FACET_FRACTIONDIGITS, FACET_LENGTH, FACET_MAXEXCLUSIVE, FACET_MAXINCLUSIVE, FACET_MAXLENGTH, FACET_MINEXCLUSIVE, FACET_MININCLUSIVE, FACET_MINLENGTH, FACET_PATTERN, FACET_TOTALDIGITS, FACET_WHITESPACE, FIXED, NOT_ALLOWED, VARIETY_ATOMIC, VARIETY_LIST, VARIETY_UNION, XMLSCHEMA_NSURI
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXSDatatypeImpl(java.lang.String uri, java.lang.String typeName, WhiteSpaceProcessor whiteSpace)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void_checkValid(java.lang.String content, org.relaxng.datatype.ValidationContext context)actual 'meat' of the checkValid methodprotected abstract java.lang.Object_createJavaObject(java.lang.String literal, org.relaxng.datatype.ValidationContext context)protected abstract java.lang.Object_createValue(java.lang.String content, org.relaxng.datatype.ValidationContext context)converts a whitespace-processed lexical value into the corresponding value objectprotected abstract booleancheckFormat(java.lang.String literal, org.relaxng.datatype.ValidationContext context)voidcheckValid(java.lang.String content, org.relaxng.datatype.ValidationContext context)java.lang.ObjectcreateJavaObject(java.lang.String literal, org.relaxng.datatype.ValidationContext context)converts lexcial value to a corresponding Java-friendly object by using the given context information.org.relaxng.datatype.DatatypeStreamingValidatorcreateStreamingValidator(org.relaxng.datatype.ValidationContext context)java.lang.ObjectcreateValue(java.lang.String lexicalValue, org.relaxng.datatype.ValidationContext context)XSDatatypegetAncestorBuiltinType()Gets the nearest ancestor built-in type.java.lang.String[]getApplicableFacetNames()Gets the names of all applicable facets.abstract ConcreteTypegetConcreteType()gets the concrete type object of the restriction chain.DataTypeWithFacetgetFacetObject(java.lang.String facetName)gets the facet object that restricts the specified facetintgetIdType()A property for RELAX NG DTD compatibility datatypes.java.lang.StringgetName()gets the local name of the type.java.lang.StringgetNamespaceUri()Gets the namespace URI of this simple type definition.booleanisAlwaysValid()Returns true if this datatype is known to accept any string.booleanisContextDependent()A property for RELAX NG DTD compatibility datatypes.booleanisDerivedTypeOf(XSDatatype baseType, boolean restrictionAllowed)tests if this type is a derived type of the specified type.static booleanisDerivedTypeOf(XSDatatype base, XSDatatype derived, boolean restrictionAllowed)an implementation of "Type Derivation OK (Simple)" of the spec.booleanisValid(java.lang.String literal, org.relaxng.datatype.ValidationContext context)static java.lang.Stringlocalize(java.lang.String prop)static java.lang.Stringlocalize(java.lang.String prop, java.lang.Object arg1)static java.lang.Stringlocalize(java.lang.String prop, java.lang.Object[] args)static java.lang.Stringlocalize(java.lang.String prop, java.lang.Object arg1, java.lang.Object arg2)static java.lang.Stringlocalize(java.lang.String prop, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)protected booleanneedValueCheck()booleansameValue(java.lang.Object o1, java.lang.Object o2)intvalueHashCode(java.lang.Object o)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.msv.datatype.DatabindableDatatype
getJavaObjectType, serializeJavaObject
-
Methods inherited from interface com.sun.msv.datatype.xsd.XSDatatype
convertToLexicalValue, displayName, getBaseType, getVariety, isFacetApplicable, isFinal
-
-
-
-
Field Detail
-
namespaceUri
private final java.lang.String namespaceUri
-
typeName
private final java.lang.String typeName
-
whiteSpace
public final WhiteSpaceProcessor whiteSpace
this field characterizes how this datatype treats white space.
-
serializedValueChecker
protected static final org.relaxng.datatype.ValidationContext serializedValueChecker
-
ERR_INAPPROPRIATE_FOR_TYPE
public static final java.lang.String ERR_INAPPROPRIATE_FOR_TYPE
- See Also:
- Constant Field Values
-
ERR_TOO_MUCH_PRECISION
public static final java.lang.String ERR_TOO_MUCH_PRECISION
- See Also:
- Constant Field Values
-
ERR_TOO_MUCH_SCALE
public static final java.lang.String ERR_TOO_MUCH_SCALE
- See Also:
- Constant Field Values
-
ERR_ENUMERATION
public static final java.lang.String ERR_ENUMERATION
- See Also:
- Constant Field Values
-
ERR_ENUMERATION_WITH_ARG
public static final java.lang.String ERR_ENUMERATION_WITH_ARG
- See Also:
- Constant Field Values
-
ERR_OUT_OF_RANGE
public static final java.lang.String ERR_OUT_OF_RANGE
- See Also:
- Constant Field Values
-
ERR_LENGTH
public static final java.lang.String ERR_LENGTH
- See Also:
- Constant Field Values
-
ERR_MINLENGTH
public static final java.lang.String ERR_MINLENGTH
- See Also:
- Constant Field Values
-
ERR_MAXLENGTH
public static final java.lang.String ERR_MAXLENGTH
- See Also:
- Constant Field Values
-
ERR_PATTERN_1
public static final java.lang.String ERR_PATTERN_1
- See Also:
- Constant Field Values
-
ERR_PATTERN_MANY
public static final java.lang.String ERR_PATTERN_MANY
- See Also:
- Constant Field Values
-
ERR_INVALID_ITEMTYPE
public static final java.lang.String ERR_INVALID_ITEMTYPE
- See Also:
- Constant Field Values
-
ERR_INVALID_MEMBER_TYPE
public static final java.lang.String ERR_INVALID_MEMBER_TYPE
- See Also:
- Constant Field Values
-
ERR_INVALID_BASE_TYPE
public static final java.lang.String ERR_INVALID_BASE_TYPE
- See Also:
- Constant Field Values
-
ERR_INVALID_WHITESPACE_VALUE
public static final java.lang.String ERR_INVALID_WHITESPACE_VALUE
- See Also:
- Constant Field Values
-
ERR_PARSE_ERROR
public static final java.lang.String ERR_PARSE_ERROR
- See Also:
- Constant Field Values
-
ERR_INVALID_VALUE_FOR_THIS_TYPE
public static final java.lang.String ERR_INVALID_VALUE_FOR_THIS_TYPE
- See Also:
- Constant Field Values
-
ERR_FACET_MUST_BE_NON_NEGATIVE_INTEGER
public static final java.lang.String ERR_FACET_MUST_BE_NON_NEGATIVE_INTEGER
- See Also:
- Constant Field Values
-
ERR_FACET_MUST_BE_POSITIVE_INTEGER
public static final java.lang.String ERR_FACET_MUST_BE_POSITIVE_INTEGER
- See Also:
- Constant Field Values
-
ERR_OVERRIDING_FIXED_FACET
public static final java.lang.String ERR_OVERRIDING_FIXED_FACET
- See Also:
- Constant Field Values
-
ERR_INCONSISTENT_FACETS_1
public static final java.lang.String ERR_INCONSISTENT_FACETS_1
- See Also:
- Constant Field Values
-
ERR_INCONSISTENT_FACETS_2
public static final java.lang.String ERR_INCONSISTENT_FACETS_2
- See Also:
- Constant Field Values
-
ERR_X_AND_Y_ARE_EXCLUSIVE
public static final java.lang.String ERR_X_AND_Y_ARE_EXCLUSIVE
- See Also:
- Constant Field Values
-
ERR_LOOSENED_FACET
public static final java.lang.String ERR_LOOSENED_FACET
- See Also:
- Constant Field Values
-
ERR_SCALE_IS_GREATER_THAN_PRECISION
public static final java.lang.String ERR_SCALE_IS_GREATER_THAN_PRECISION
- See Also:
- Constant Field Values
-
ERR_DUPLICATE_FACET
public static final java.lang.String ERR_DUPLICATE_FACET
- See Also:
- Constant Field Values
-
ERR_NOT_APPLICABLE_FACET
public static final java.lang.String ERR_NOT_APPLICABLE_FACET
- See Also:
- Constant Field Values
-
ERR_EMPTY_UNION
public static final java.lang.String ERR_EMPTY_UNION
- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XSDatatypeImpl
protected XSDatatypeImpl(java.lang.String uri, java.lang.String typeName, WhiteSpaceProcessor whiteSpace)
-
-
Method Detail
-
getNamespaceUri
public java.lang.String getNamespaceUri()
Description copied from interface:XSDatatypeGets the namespace URI of this simple type definition.- Specified by:
getNamespaceUriin interfaceXSDatatype
-
getName
public java.lang.String getName()
Description copied from interface:XSDatatypegets the local name of the type. If this type is an anonymous type, then this method returns null.In the terminology of the spec, this method returns the name property of this simple type component. If the name property is absent, this method returns null.
- Specified by:
getNamein interfaceXSDatatype
-
createValue
public final java.lang.Object createValue(java.lang.String lexicalValue, org.relaxng.datatype.ValidationContext context)- Specified by:
createValuein interfaceorg.relaxng.datatype.Datatype
-
_createValue
protected abstract java.lang.Object _createValue(java.lang.String content, org.relaxng.datatype.ValidationContext context)converts a whitespace-processed lexical value into the corresponding value object
-
checkValid
public final void checkValid(java.lang.String content, org.relaxng.datatype.ValidationContext context) throws org.relaxng.datatype.DatatypeException- Specified by:
checkValidin interfaceorg.relaxng.datatype.Datatype- Throws:
org.relaxng.datatype.DatatypeException
-
_checkValid
protected abstract void _checkValid(java.lang.String content, org.relaxng.datatype.ValidationContext context) throws org.relaxng.datatype.DatatypeExceptionactual 'meat' of the checkValid method- Throws:
org.relaxng.datatype.DatatypeException
-
createJavaObject
public final java.lang.Object createJavaObject(java.lang.String literal, org.relaxng.datatype.ValidationContext context)Description copied from interface:DatabindableDatatypeconverts lexcial value to a corresponding Java-friendly object by using the given context information.For the actual types returned by each type, see here.
Note that due to the difference between those Java friendly types and actual XML Schema specification, the returned object sometimes loses accuracy. For example, the "time" type allows "0.0000000000001 sec" which cannot be represented in
java.util.Calendarclass.- Specified by:
createJavaObjectin interfaceDatabindableDatatype- Returns:
- null when the given lexical value is not a valid lexical value for this type.
-
_createJavaObject
protected abstract java.lang.Object _createJavaObject(java.lang.String literal, org.relaxng.datatype.ValidationContext context)
-
isValid
public final boolean isValid(java.lang.String literal, org.relaxng.datatype.ValidationContext context)- Specified by:
isValidin interfaceorg.relaxng.datatype.Datatype
-
isAlwaysValid
public boolean isAlwaysValid()
Description copied from interface:XSDatatypeReturns 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.
- Specified by:
isAlwaysValidin interfaceXSDatatype
-
createStreamingValidator
public org.relaxng.datatype.DatatypeStreamingValidator createStreamingValidator(org.relaxng.datatype.ValidationContext context)
- Specified by:
createStreamingValidatorin interfaceorg.relaxng.datatype.Datatype
-
checkFormat
protected abstract boolean checkFormat(java.lang.String literal, org.relaxng.datatype.ValidationContext context)
-
needValueCheck
protected boolean needValueCheck()
-
getFacetObject
public DataTypeWithFacet getFacetObject(java.lang.String facetName)
gets the facet object that restricts the specified facet- Specified by:
getFacetObjectin interfaceXSDatatype- Returns:
- null if no such facet object exists.
-
getApplicableFacetNames
public java.lang.String[] getApplicableFacetNames()
Description copied from interface:XSDatatypeGets the names of all applicable facets.- Specified by:
getApplicableFacetNamesin interfaceXSDatatype
-
getConcreteType
public abstract ConcreteType getConcreteType()
gets the concrete type object of the restriction chain.
-
sameValue
public final boolean sameValue(java.lang.Object o1, java.lang.Object o2)- Specified by:
sameValuein interfaceorg.relaxng.datatype.Datatype
-
valueHashCode
public final int valueHashCode(java.lang.Object o)
- Specified by:
valueHashCodein interfaceorg.relaxng.datatype.Datatype
-
isDerivedTypeOf
public final boolean isDerivedTypeOf(XSDatatype baseType, boolean restrictionAllowed)
Description copied from interface:XSDatatypetests 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.
- Specified by:
isDerivedTypeOfin interfaceXSDatatyperestrictionAllowed- 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.
-
isDerivedTypeOf
public static boolean isDerivedTypeOf(XSDatatype base, XSDatatype derived, boolean restrictionAllowed)
an implementation of "Type Derivation OK (Simple)" of the spec.- See Also:
isDerivedTypeOf(XSDatatype,boolean)
-
getAncestorBuiltinType
public XSDatatype getAncestorBuiltinType()
Description copied from interface:XSDatatypeGets 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.
- Specified by:
getAncestorBuiltinTypein interfaceXSDatatype- Returns:
- Always return non-null valid object.
-
getIdType
public int getIdType()
A property for RELAX NG DTD compatibility datatypes.ID_TYPE_NULLis returned by default.- Specified by:
getIdTypein interfaceorg.relaxng.datatype.Datatype
-
isContextDependent
public boolean isContextDependent()
A property for RELAX NG DTD compatibility datatypes. Context-independent by default.- Specified by:
isContextDependentin interfaceorg.relaxng.datatype.Datatype
-
localize
public static java.lang.String localize(java.lang.String prop, java.lang.Object[] args)
-
localize
public static java.lang.String localize(java.lang.String prop)
-
localize
public static java.lang.String localize(java.lang.String prop, java.lang.Object arg1)
-
localize
public static java.lang.String localize(java.lang.String prop, java.lang.Object arg1, java.lang.Object arg2)
-
localize
public static java.lang.String localize(java.lang.String prop, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
-
-