## org.apache.xerces.impl.dv.xs
Class XSSimpleTypeDecl

    java.lang.Object
      |
      +--org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

All Implemented Interfaces:
  XSObject, XSSimpleType, XSSimpleTypeDefinition, XSTypeDefinition

public class XSSimpleTypeDecl
extends java.lang.Object
implements XSSimpleType

Version:
  $Id: XSSimpleTypeDecl.java,v 1.35 2003/03/17 15:00:31 sandygao Exp $
Author:
  Sandy Gao, IBM, Neeraj Bajaj, Sun Microsystems, inc.

Fields inherited from interface org.apache.xerces.impl.dv.XSSimpleType
`PRIMITIVE_ANYURI, PRIMITIVE_BASE64BINARY, PRIMITIVE_BOOLEAN, PRIMITIVE_DATE, PRIMITIVE_DATETIME, PRIMITIVE_DECIMAL, PRIMITIVE_DOUBLE, PRIMITIVE_DURATION, PRIMITIVE_FLOAT, PRIMITIVE_GDAY, PRIMITIVE_GMONTH, PRIMITIVE_GMONTHDAY, PRIMITIVE_GYEAR, PRIMITIVE_GYEARMONTH, PRIMITIVE_HEXBINARY, PRIMITIVE_NOTATION, PRIMITIVE_QNAME, PRIMITIVE_STRING, PRIMITIVE_TIME, WS_COLLAPSE, WS_PRESERVE, WS_REPLACE`

Fields inherited from interface org.apache.xerces.impl.xs.psvi.XSSimpleTypeDefinition
`FACET_ENUMERATION, FACET_FRACTIONDIGITS, FACET_LENGTH, FACET_MAXEXCLUSIVE, FACET_MAXINCLUSIVE, FACET_MAXLENGTH, FACET_MINEXCLUSIVE, FACET_MININCLUSIVE, FACET_MINLENGTH, FACET_NONE, FACET_PATTERN, FACET_TOTALDIGITS, FACET_WHITESPACE, ORDERED_FALSE, ORDERED_PARTIAL, ORDERED_TOTAL, VARIETY_ABSENT, VARIETY_ATOMIC, VARIETY_LIST, VARIETY_UNION`

Fields inherited from interface org.apache.xerces.impl.xs.psvi.XSTypeDefinition
`COMPLEX_TYPE, SIMPLE_TYPE`

Constructor Summary
`` `XSSimpleTypeDecl()`
`protected` `XSSimpleTypeDecl(java.lang.String name, java.lang.String uri, short finalSet, XSSimpleTypeDecl[] memberTypes)`
`protected` `XSSimpleTypeDecl(java.lang.String name, java.lang.String uri, short finalSet, XSSimpleTypeDecl itemType, boolean isImmutable)`
`protected` `XSSimpleTypeDecl(XSSimpleTypeDecl base, java.lang.String name, short validateDV, short ordered, boolean bounded, boolean finite, boolean numeric, boolean isImmutable)`
`protected` `XSSimpleTypeDecl(XSSimpleTypeDecl base, java.lang.String name, java.lang.String uri, short finalSet, boolean isImmutable)`

Method Summary
`void` `applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)` If <restriction> is chosen
`boolean` `derivedFrom(java.lang.String ancestorNS, java.lang.String ancestorName, short derivation)` Convenience method: check if this type is derived from the given ancestor type.
`boolean` `derivedFromType(XSTypeDefinition ancestor, short derivation)` Convenience method: check if this type is derived from the given `ancestorType`.
`XSAnnotation` `getAnnotation()` Optional.
`boolean` `getAnonymous()` Convenience.
`XSTypeDefinition` `getBaseType()` {base type definition}: either a simple type definition or a complex type definition.
`boolean` `getBounded()` Fundamental Facet: bounded.
`short` `getDefinedFacets()` [facets]: get all facets defined on this type.
`short` `getFinal()` 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`.
`boolean` `getFinite()` Fundamental Facet: cardinality.
`short` `getFixedFacets()` [facets]: get all facets defined and fixed on this type.
`XSSimpleTypeDefinition` `getItemType()` If variety is `list` the item type definition (an atomic or union simple type definition) is available, otherwise `null`.
`StringList` `getLexicalEnumeration()` Returns a list of enumeration values.
`java.lang.String` `getLexicalFacetValue(short facetName)` Convenience method.
`StringList` `getLexicalPattern()` Returns a list of pattern values.
`XSObjectList` `getMemberTypes()` If variety is `union` the list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise `null`.
`java.lang.String` `getName()` The name of type `NCName` of this declaration as defined in XML Namespaces.
`java.lang.String` `getNamespace()` The [target namespace] of this object, or `null` if it is unspecified.
`XSNamespaceItem` `getNamespaceItem()` A namespace schema information itemcorresponding to the target namespace of the component, if it's globally declared; or null otherwise.
`boolean` `getNumeric()` Fundamental Facet: numeric.
`short` `getOrdered()` Fundamental Facet: ordered
`short` `getPrimitiveKind()` return an ID representing the built-in primitive base type.
`XSSimpleTypeDefinition` `getPrimitiveType()` If variety is `atomic` the primitive type definition (a built-in primitive datatype definition or the simple ur-type definition) is available, otherwise `null`.
`short` `getType()` The `type` of this object, i.e.
`short` `getTypeCategory()` Return whether this type definition is a simple type or complex type.
`short` `getVariety()` [variety]: one of {atomic, list, union} or absent
`short` `getWhitespace()` Return the whitespace corresponding to this datatype.
`boolean` `isDefinedFacet(short facetName)` Convenience method.
`boolean` `isEqual(java.lang.Object value1, java.lang.Object value2)` Check whether two actual values are equal.
`boolean` `isFinal(short derivation)` {final}.
`boolean` `isFixedFacet(short facetName)` Convenience method.
`boolean` `isIDType()` Check whether this type is or is derived from ID.
`protected java.lang.String` `normalize(java.lang.Object content, short ws)`
`static java.lang.String` `normalize(java.lang.String content, short ws)`
`void` `reset()`
`protected XSSimpleTypeDecl` `setListValues(java.lang.String name, java.lang.String uri, short finalSet, XSSimpleTypeDecl itemType)`
`protected XSSimpleTypeDecl` `setRestrictionValues(XSSimpleTypeDecl base, java.lang.String name, java.lang.String uri, short finalSet)`
`protected XSSimpleTypeDecl` `setUnionValues(java.lang.String name, java.lang.String uri, short finalSet, XSSimpleTypeDecl[] memberTypes)`
`java.lang.String` `toString()`
`java.lang.Object` `validate(java.lang.Object content, ValidationContext context, ValidatedInfo validatedInfo)` validate a value, and return the compiled form
`java.lang.Object` `validate(java.lang.String content, ValidationContext context, ValidatedInfo validatedInfo)` validate a value, and return the compiled form
`void` `validate(ValidationContext context, ValidatedInfo validatedInfo)` validate an actual value against this DV

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### XSSimpleTypeDecl

    public XSSimpleTypeDecl()

### XSSimpleTypeDecl

    protected XSSimpleTypeDecl(XSSimpleTypeDecl base,
                               java.lang.String name,
                               short validateDV,
                               short ordered,
                               boolean bounded,
                               boolean finite,
                               boolean numeric,
                               boolean isImmutable)

### XSSimpleTypeDecl

    protected XSSimpleTypeDecl(XSSimpleTypeDecl base,
                               java.lang.String name,
                               java.lang.String uri,
                               short finalSet,
                               boolean isImmutable)

### XSSimpleTypeDecl

    protected XSSimpleTypeDecl(java.lang.String name,
                               java.lang.String uri,
                               short finalSet,
                               XSSimpleTypeDecl itemType,
                               boolean isImmutable)

### XSSimpleTypeDecl

    protected XSSimpleTypeDecl(java.lang.String name,
                               java.lang.String uri,
                               short finalSet,
                               XSSimpleTypeDecl[] memberTypes)

Method Detail

### setRestrictionValues

    protected XSSimpleTypeDecl setRestrictionValues(XSSimpleTypeDecl base,
                                                    java.lang.String name,
                                                    java.lang.String uri,
                                                    short finalSet)

### setListValues

    protected XSSimpleTypeDecl setListValues(java.lang.String name,
                                             java.lang.String uri,
                                             short finalSet,
                                             XSSimpleTypeDecl itemType)

### setUnionValues

    protected XSSimpleTypeDecl setUnionValues(java.lang.String name,
                                              java.lang.String uri,
                                              short finalSet,
                                              XSSimpleTypeDecl[] memberTypes)

### 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 java.lang.String getName()

  Description copied from interface: `XSObject`
  The name of type `NCName` of this declaration as defined in XML Namespaces.
  Specified by:
    `getName` in interface `XSObject`

### getNamespace

    public java.lang.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 complex type definition it is a subset of {extension, restriction}. For simple type definition it is a subset of {extension, list, restriction, union}.
  Specified by:
    `isFinal` in interface `XSTypeDefinition`
  Following copied from interface: `org.apache.xerces.impl.xs.psvi.XSTypeDefinition`
  Parameters:
    `restriction` - Extension, restriction, list, union constants (defined in `XSConstants`).
  Returns:
    True if restriction is in the final set, otherwise false.

### getBaseType

    public XSTypeDefinition getBaseType()

  Description copied from interface: `XSTypeDefinition`
  {base type definition}: either a simple type definition or a complex type definition.
  Specified by:
    `getBaseType` in interface `XSTypeDefinition`

### getAnonymous

    public boolean getAnonymous()

  Description copied from interface: `XSTypeDefinition`
  Convenience. A boolean that specifies if the type definition is anonymous. Convenience attribute.
  Specified by:
    `getAnonymous` in interface `XSTypeDefinition`

### getVariety

    public short getVariety()

  Description copied from interface: `XSSimpleTypeDefinition`
  [variety]: one of {atomic, list, union} or absent
  Specified by:
    `getVariety` in interface `XSSimpleTypeDefinition`

### 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`
  Following copied from interface: `org.apache.xerces.impl.dv.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`
  Following copied from interface: `org.apache.xerces.impl.dv.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`
  Following copied from interface: `org.apache.xerces.impl.dv.XSSimpleType`
  Returns:
    an ID representing the built-in primitive base type

### getPrimitiveType

    public XSSimpleTypeDefinition getPrimitiveType()

  Description copied from interface: `XSSimpleTypeDefinition`
  If variety is `atomic` the primitive type definition (a built-in primitive datatype definition or the simple ur-type definition) is available, otherwise `null`.
  Specified by:
    `getPrimitiveType` in interface `XSSimpleTypeDefinition`

### getItemType

    public XSSimpleTypeDefinition getItemType()

  Description copied from interface: `XSSimpleTypeDefinition`
  If variety is `list` the item type definition (an atomic or union simple type definition) is available, otherwise `null`.
  Specified by:
    `getItemType` in interface `XSSimpleTypeDefinition`

### getMemberTypes

    public XSObjectList getMemberTypes()

  Description copied from interface: `XSSimpleTypeDefinition`
  If variety is `union` the list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise `null`.
  Specified by:
    `getMemberTypes` in interface `XSSimpleTypeDefinition`

### applyFacets

    public void applyFacets(XSFacets facets,
                            short presentFacet,
                            short fixedFacet,
                            ValidationContext context)
                     throws InvalidDatatypeFacetException

  If <restriction> is chosen
  Specified by:
    `applyFacets` in interface `XSSimpleType`
  Following copied from interface: `org.apache.xerces.impl.dv.XSSimpleType`
  Parameters:
    `facets` - the value of all the facets
    `presentFacets` - bit combination value of the costraining facet constants which are present.
    `fixedFacets` - bit combination value of the costraining facet constants which are fixed.
    `ValidationContext` - the validation context
  Throws:
    `InvalidDatatypeFacetException` - exception for invalid facet values.

### validate

    public java.lang.Object validate(java.lang.String content,
                                     ValidationContext context,
                                     ValidatedInfo validatedInfo)
                              throws InvalidDatatypeValueException

  validate a value, and return the compiled form
  Specified by:
    `validate` in interface `XSSimpleType`
  Following copied from interface: `org.apache.xerces.impl.dv.XSSimpleType`
  Parameters:
    `content` - the string value that needs to be validated
    `context` - the validation context
    `validatedInfo` - used to store validation result
  Returns:
    the actual value (QName, Boolean) of the string value

### validate

    public java.lang.Object validate(java.lang.Object content,
                                     ValidationContext context,
                                     ValidatedInfo validatedInfo)
                              throws InvalidDatatypeValueException

  validate a value, and return the compiled form
  Specified by:
    `validate` in interface `XSSimpleType`
  Following copied from interface: `org.apache.xerces.impl.dv.XSSimpleType`
  Parameters:
    `content` - the string value that needs to be validated
    `context` - the validation context
    `validatedInfo` - used to store validation result
  Returns:
    the actual value (QName, Boolean) of the string value

### validate

    public void validate(ValidationContext context,
                         ValidatedInfo validatedInfo)
                  throws InvalidDatatypeValueException

  validate an actual value against this DV
  Specified by:
    `validate` in interface `XSSimpleType`
  Parameters:
    `value` - the actual value that needs to be validated
    `context` - the validation context
    `validatedInfo` - used to provide the actual value and member types

### isEqual

    public boolean isEqual(java.lang.Object value1,
                           java.lang.Object value2)

  Description copied from interface: `XSSimpleType`
  Check whether two actual values are equal.
  Specified by:
    `isEqual` in interface `XSSimpleType`
  Following copied from interface: `org.apache.xerces.impl.dv.XSSimpleType`
  Parameters:
    `value1` - the first value
    `value2` - the second value
  Returns:
    true if the two value are equal

### normalize

    public static java.lang.String normalize(java.lang.String content,
                                             short ws)

### normalize

    protected java.lang.String normalize(java.lang.Object content,
                                         short ws)

### getOrdered

    public short getOrdered()

  Description copied from interface: `XSSimpleTypeDefinition`
  Fundamental Facet: ordered
  Specified by:
    `getOrdered` in interface `XSSimpleTypeDefinition`

### getBounded

    public boolean getBounded()

  Description copied from interface: `XSSimpleTypeDefinition`
  Fundamental Facet: bounded.
  Specified by:
    `getBounded` in interface `XSSimpleTypeDefinition`

### getFinite

    public boolean getFinite()

  Description copied from interface: `XSSimpleTypeDefinition`
  Fundamental Facet: cardinality.
  Specified by:
    `getFinite` in interface `XSSimpleTypeDefinition`

### getNumeric

    public boolean getNumeric()

  Description copied from interface: `XSSimpleTypeDefinition`
  Fundamental Facet: numeric.
  Specified by:
    `getNumeric` in interface `XSSimpleTypeDefinition`

### isDefinedFacet

    public boolean isDefinedFacet(short facetName)

  Description copied from interface: `XSSimpleTypeDefinition`
  Convenience method. [Facets]: check whether a facet is defined on this type.
  Specified by:
    `isDefinedFacet` in interface `XSSimpleTypeDefinition`
  Following copied from interface: `org.apache.xerces.impl.xs.psvi.XSSimpleTypeDefinition`
  Parameters:
    `facetName` - The name of the facet.
  Returns:
    True if the facet is defined, false otherwise.

### getDefinedFacets

    public short getDefinedFacets()

  Description copied from interface: `XSSimpleTypeDefinition`
  [facets]: get 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)

  Description copied from interface: `XSSimpleTypeDefinition`
  Convenience method. [Facets]: check whether a facet is defined and fixed on this type.
  Specified by:
    `isFixedFacet` in interface `XSSimpleTypeDefinition`
  Following copied from interface: `org.apache.xerces.impl.xs.psvi.XSSimpleTypeDefinition`
  Parameters:
    `facetName` - The name of the facet.
  Returns:
    True if the facet is fixed, false otherwise.

### getFixedFacets

    public short getFixedFacets()

  Description copied from interface: `XSSimpleTypeDefinition`
  [facets]: get all facets defined and fixed on this type.
  Specified by:
    `getFixedFacets` in interface `XSSimpleTypeDefinition`

### getLexicalFacetValue

    public java.lang.String getLexicalFacetValue(short facetName)

  Description copied from interface: `XSSimpleTypeDefinition`
  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`
  Following copied from interface: `org.apache.xerces.impl.xs.psvi.XSSimpleTypeDefinition`
  Parameters:
    `facetName` - The name of the facet, i.e. `FACET_LENGTH, FACET_TOTALDIGITS` (see `XSConstants`).To retrieve value for pattern or enumeration, see `enumeration` and `pattern`.
  Returns:
    A value of the facet specified in `facetName` for this simple type definition or `null`.

### getLexicalEnumeration

    public StringList getLexicalEnumeration()

  Description copied from interface: `XSSimpleTypeDefinition`
  Returns a list of enumeration values.
  Specified by:
    `getLexicalEnumeration` in interface `XSSimpleTypeDefinition`

### getLexicalPattern

    public StringList getLexicalPattern()

  Description copied from interface: `XSSimpleTypeDefinition`
  Returns a list of pattern values.
  Specified by:
    `getLexicalPattern` in interface `XSSimpleTypeDefinition`

### getAnnotation

    public XSAnnotation getAnnotation()

  Description copied from interface: `XSSimpleTypeDefinition`
  Optional. An [annotation].
  Specified by:
    `getAnnotation` in interface `XSSimpleTypeDefinition`

### derivedFromType

    public boolean derivedFromType(XSTypeDefinition ancestor,
                                   short derivation)

  Description copied from interface: `XSTypeDefinition`
  Convenience method: check if this type is derived from the given `ancestorType`.
  Specified by:
    `derivedFromType` in interface `XSTypeDefinition`
  Following copied from interface: `org.apache.xerces.impl.xs.psvi.XSTypeDefinition`
  Parameters:
    `ancestorType` - An ancestor type definition.
    `derivationMethod` - A bit combination representing a subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` }.
  Returns:
    Return true if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod`. Return true if this type is derived from `ancestorType`.

### derivedFrom

    public boolean derivedFrom(java.lang.String ancestorNS,
                               java.lang.String ancestorName,
                               short derivation)

  Description copied from interface: `XSTypeDefinition`
  Convenience method: check if this type is derived from the given ancestor type.
  Specified by:
    `derivedFrom` in interface `XSTypeDefinition`
  Following copied from interface: `org.apache.xerces.impl.xs.psvi.XSTypeDefinition`
  Parameters:
    `namespace` - An ancestor type namespace.
    `name` - An ancestor type name.
    `derivationMethod` - A bit combination representing a subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` }.
  Returns:
    Return true if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod`. Return true if this type is derived from `ancestorType`.

### reset

    public void reset()

### getNamespaceItem

    public XSNamespaceItem getNamespaceItem()

  Description copied from interface: `XSObject`
  A namespace schema information itemcorresponding to the target namespace of the component, if it's globally declared; or null otherwise.
  Specified by:
    `getNamespaceItem` in interface `XSObject`
  See Also:
    `XSObject.getNamespaceItem()`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`
  See Also:
    `Object.toString()`

Copyright © 1999-2003 Apache XML Project. All Rights Reserved.