Class XSDatatypeImpl

    • Method Detail

      • getNamespaceUri

        public String getNamespaceUri()
        Description copied from interface: XSDatatype
        Gets the namespace URI of this simple type definition.
        Specified by:
        getNamespaceUri in interface XSDatatype
      • getName

        public String getName()
        Description copied from interface: XSDatatype
        gets 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:
        getName in interface XSDatatype
      • createValue

        public final Object createValue​(String lexicalValue,
                                        org.relaxng.datatype.ValidationContext context)
        Specified by:
        createValue in interface org.relaxng.datatype.Datatype
      • _createValue

        protected abstract Object _createValue​(String content,
                                               org.relaxng.datatype.ValidationContext context)
        converts a whitespace-processed lexical value into the corresponding value object
      • checkValid

        public final void checkValid​(String content,
                                     org.relaxng.datatype.ValidationContext context)
                              throws org.relaxng.datatype.DatatypeException
        Specified by:
        checkValid in interface org.relaxng.datatype.Datatype
        Throws:
        org.relaxng.datatype.DatatypeException
      • _checkValid

        protected abstract void _checkValid​(String content,
                                            org.relaxng.datatype.ValidationContext context)
                                     throws org.relaxng.datatype.DatatypeException
        actual 'meat' of the checkValid method
        Throws:
        org.relaxng.datatype.DatatypeException
      • createJavaObject

        public final Object createJavaObject​(String literal,
                                             org.relaxng.datatype.ValidationContext context)
        Description copied from interface: DatabindableDatatype
        converts 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.Calendar class.

        Specified by:
        createJavaObject in interface DatabindableDatatype
        Returns:
        null when the given lexical value is not a valid lexical value for this type.
      • _createJavaObject

        protected abstract Object _createJavaObject​(String literal,
                                                    org.relaxng.datatype.ValidationContext context)
      • isValid

        public final boolean isValid​(String literal,
                                     org.relaxng.datatype.ValidationContext context)
        Specified by:
        isValid in interface org.relaxng.datatype.Datatype
      • isAlwaysValid

        public boolean isAlwaysValid()
        Description copied from interface: XSDatatype
        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.

        Specified by:
        isAlwaysValid in interface XSDatatype
      • createStreamingValidator

        public org.relaxng.datatype.DatatypeStreamingValidator createStreamingValidator​(org.relaxng.datatype.ValidationContext context)
        Specified by:
        createStreamingValidator in interface org.relaxng.datatype.Datatype
      • checkFormat

        protected abstract boolean checkFormat​(String literal,
                                               org.relaxng.datatype.ValidationContext context)
      • needValueCheck

        protected boolean needValueCheck()
      • getFacetObject

        public DataTypeWithFacet getFacetObject​(String facetName)
        gets the facet object that restricts the specified facet
        Specified by:
        getFacetObject in interface XSDatatype
        Returns:
        null if no such facet object exists.
      • getConcreteType

        public abstract ConcreteType getConcreteType()
        gets the concrete type object of the restriction chain.
      • sameValue

        public final boolean sameValue​(Object o1,
                                       Object o2)
        Specified by:
        sameValue in interface org.relaxng.datatype.Datatype
      • valueHashCode

        public final int valueHashCode​(Object o)
        Specified by:
        valueHashCode in interface org.relaxng.datatype.Datatype
      • isDerivedTypeOf

        public final boolean isDerivedTypeOf​(XSDatatype baseType,
                                             boolean restrictionAllowed)
        Description copied from interface: XSDatatype
        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.

        Specified by:
        isDerivedTypeOf in interface XSDatatype
        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.

      • getAncestorBuiltinType

        public XSDatatype getAncestorBuiltinType()
        Description copied from interface: XSDatatype
        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.

        Specified by:
        getAncestorBuiltinType in interface XSDatatype
        Returns:
        Always return non-null valid object.
      • getIdType

        public int getIdType()
        A property for RELAX NG DTD compatibility datatypes. ID_TYPE_NULL is returned by default.
        Specified by:
        getIdType in interface org.relaxng.datatype.Datatype
      • isContextDependent

        public boolean isContextDependent()
        A property for RELAX NG DTD compatibility datatypes. Context-independent by default.
        Specified by:
        isContextDependent in interface org.relaxng.datatype.Datatype