Class XSSimpleTypeDecl

    • Constructor Detail

      • XSSimpleTypeDecl

        public XSSimpleTypeDecl()
      • XSSimpleTypeDecl

        protected XSSimpleTypeDecl​(XSSimpleTypeDecl base,
                                   String name,
                                   short validateDV,
                                   short ordered,
                                   boolean bounded,
                                   boolean finite,
                                   boolean numeric,
                                   boolean isImmutable,
                                   short builtInKind)
    • Method Detail

      • getType

        public short getType()
        Description copied from interface: XSObject
        The type of this object, i.e. ELEMENT_DECLARATION.
        Specified by:
        getType in interface XSObject
      • getTypeCategory

        public short getTypeCategory()
        Description copied from interface: XSTypeDefinition
        Return whether this type definition is a simple type or complex type.
        Specified by:
        getTypeCategory in interface XSTypeDefinition
      • getName

        public String getName()
        Description copied from interface: XSObject
        The name of type NCName, as defined in XML Namespaces, of this declaration specified in the {name} property of the component or null if the definition of this component does not have a {name} property. For anonymous types, the processor must construct and expose an anonymous type name that is distinct from the name of every named type and the name of every other anonymous type.
        Specified by:
        getName in interface XSObject
      • getNamespace

        public String getNamespace()
        Description copied from interface: XSObject
        The [target namespace] of this object, or null if it is unspecified.
        Specified by:
        getNamespace in interface XSObject
      • getFinal

        public short getFinal()
        Description copied from interface: XSTypeDefinition
        For complex types the returned value is a bit combination of the subset of {DERIVATION_EXTENSION, DERIVATION_RESTRICTION} corresponding to final set of this type or DERIVATION_NONE. For simple types the returned value is a bit combination of the subset of { DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST } corresponding to final set of this type or DERIVATION_NONE.
        Specified by:
        getFinal in interface XSTypeDefinition
      • isFinal

        public boolean isFinal​(short derivation)
        Description copied from interface: XSTypeDefinition
        {final}. For a complex type definition it is a subset of {extension, restriction}. For a simple type definition it is a subset of {extension, list, restriction, union}.
        Specified by:
        isFinal in interface XSTypeDefinition
        Parameters:
        derivation - Extension, restriction, list, union constants (defined in XSConstants).
        Returns:
        True if restriction is in the final set, otherwise false.
      • getAnonymous

        public boolean getAnonymous()
        Description copied from interface: XSTypeDefinition
        Convenience attribute. A boolean that specifies if the type definition is anonymous.
        Specified by:
        getAnonymous in interface XSTypeDefinition
      • isIDType

        public boolean isIDType()
        Description copied from interface: XSSimpleType
        Check whether this type is or is derived from ID. REVISIT: this method makes ID special, which is not a good design. but since ID is not a primitive, there doesn't seem to be a clean way of doing it except to define special method like this.
        Specified by:
        isIDType in interface XSSimpleType
        Returns:
        whether this simple type is or is derived from ID.
      • getWhitespace

        public short getWhitespace()
                            throws DatatypeException
        Description copied from interface: XSSimpleType
        Return the whitespace corresponding to this datatype.
        Specified by:
        getWhitespace in interface XSSimpleType
        Returns:
        valid values are WS_PRESERVE, WS_REPLACE, WS_COLLAPSE.
        Throws:
        DatatypeException - union datatypes don't have whitespace facet associated with them
      • getPrimitiveKind

        public short getPrimitiveKind()
        Description copied from interface: XSSimpleType
        return an ID representing the built-in primitive base type. REVISIT: This method is (currently) for internal use only. the constants returned from this method are not finalized yet. the names and values might change in the further.
        Specified by:
        getPrimitiveKind in interface XSSimpleType
        Returns:
        an ID representing the built-in primitive base type
      • getBuiltInKind

        public short getBuiltInKind()
        Returns the closest built-in type category this type represents or derived from. For example, if this simple type is a built-in derived type integer the INTEGER_DV is returned.
        Specified by:
        getBuiltInKind in interface XSSimpleTypeDefinition
      • getMemberTypes

        public XSObjectList getMemberTypes()
        If variety is union the list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise an empty XSObjectList.
        Specified by:
        getMemberTypes in interface XSSimpleTypeDefinition
      • applyFacets

        public void applyFacets​(XSFacets facets,
                                short presentFacet,
                                short fixedFacet,
                                ValidationContext context)
                         throws InvalidDatatypeFacetException
        If is chosen
        Specified by:
        applyFacets in interface XSSimpleType
        Parameters:
        facets - the value of all the facets
        presentFacet - bit combination value of the costraining facet constants which are present.
        fixedFacet - bit combination value of the costraining facet constants which are fixed.
        context - the validation context
        Throws:
        InvalidDatatypeFacetException - exception for invalid facet values.
      • isEqual

        public boolean isEqual​(Object value1,
                               Object value2)
        Description copied from interface: XSSimpleType
        Check whether two actual values are equal.
        Specified by:
        isEqual in interface XSSimpleType
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two value are equal
      • isIdentical

        public boolean isIdentical​(Object value1,
                                   Object value2)
      • normalize

        public static String normalize​(String content,
                                       short ws)
      • normalize

        protected String normalize​(Object content,
                                   short ws)
      • isDefinedFacet

        public boolean isDefinedFacet​(short facetName)
        Convenience method. [Facets]: check whether a facet is defined on this type.
        Specified by:
        isDefinedFacet in interface XSSimpleTypeDefinition
        Parameters:
        facetName - The name of the facet.
        Returns:
        True if the facet is defined, false otherwise.
      • getDefinedFacets

        public short getDefinedFacets()
        [facets]: all facets defined on this type. The value is a bit combination of FACET_XXX constants of all defined facets.
        Specified by:
        getDefinedFacets in interface XSSimpleTypeDefinition
      • isFixedFacet

        public boolean isFixedFacet​(short facetName)
        Convenience method. [Facets]: check whether a facet is defined and fixed on this type.
        Specified by:
        isFixedFacet in interface XSSimpleTypeDefinition
        Parameters:
        facetName - The name of the facet.
        Returns:
        True if the facet is fixed, false otherwise.
      • getLexicalFacetValue

        public String getLexicalFacetValue​(short facetName)
        Convenience method. Returns a value of a single constraining facet for this simple type definition. This method must not be used to retrieve values for enumeration and pattern facets.
        Specified by:
        getLexicalFacetValue in interface XSSimpleTypeDefinition
        Parameters:
        facetName - The name of the facet, i.e. FACET_LENGTH, FACET_TOTALDIGITS (see XSConstants). To retrieve the value for a pattern or an enumeration, see enumeration and pattern.
        Returns:
        A value of the facet specified in facetName for this simple type definition or null.
      • getActualEnumeration

        public ObjectList getActualEnumeration()
        A list of actual enumeration values if it exists, otherwise an empty ObjectList.
      • getEnumerationItemTypeList

        public ObjectList getEnumerationItemTypeList()
        A list of enumeration type values (as a list of ShortList objects) if it exists, otherwise returns null
      • getEnumerationTypeList

        public ShortList getEnumerationTypeList()
      • derivedFromType

        public boolean derivedFromType​(XSTypeDefinition ancestor,
                                       short derivation)
        Description copied from interface: XSTypeDefinition
        Convenience method which checks if this type is derived from the given ancestorType.
        Specified by:
        derivedFromType in interface XSTypeDefinition
        Parameters:
        ancestor - An ancestor type definition.
        derivation - A bit combination representing a subset of { DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST }.
        Returns:
        True if this type is derived from ancestorType using only derivation methods from the derivationMethod .
      • derivedFrom

        public boolean derivedFrom​(String ancestorNS,
                                   String ancestorName,
                                   short derivation)
        Description copied from interface: XSTypeDefinition
        Convenience method which checks if this type is derived from the given ancestor type.
        Specified by:
        derivedFrom in interface XSTypeDefinition
        Parameters:
        ancestorNS - An ancestor type namespace.
        ancestorName - An ancestor type name.
        derivation - A bit combination representing a subset of { DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST }.
        Returns:
        True if this type is derived from ancestorType using only derivation methods from the derivationMethod .
      • isDOMDerivedFrom

        public boolean isDOMDerivedFrom​(String ancestorNS,
                                        String ancestorName,
                                        int derivationMethod)
        Checks if a type is derived from another by restriction, given the name and namespace. See: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
        Parameters:
        ancestorNS - The namspace of the ancestor type declaration
        ancestorName - The name of the ancestor type declaration
        derivationMethod - The derivation method
        Returns:
        boolean True if the ancestor type is derived from the reference type by the specifiied derivation method.
      • reset

        public void reset()
      • setNamespaceItem

        public void setNamespaceItem​(XSNamespaceItem namespaceItem)
      • getFacets

        public XSObjectList getFacets()
        A list of constraining facets if it exists, otherwise an empty XSObjectList. Note: This method must not be used to retrieve values for enumeration and pattern facets.
        Specified by:
        getFacets in interface XSSimpleTypeDefinition
      • getMinInclusiveValue

        public Object getMinInclusiveValue()
      • getMinExclusiveValue

        public Object getMinExclusiveValue()
      • getMaxInclusiveValue

        public Object getMaxInclusiveValue()
      • getMaxExclusiveValue

        public Object getMaxExclusiveValue()
      • setAnonymous

        public void setAnonymous​(boolean anon)
      • isDerivedFrom

        public boolean isDerivedFrom​(String typeNamespaceArg,
                                     String typeNameArg,
                                     int derivationMethod)
        Specified by:
        isDerivedFrom in interface TypeInfo