org.apache.xerces.impl.dv.xs

## Class XSSimpleTypeDelegate

- java.lang.Object
- - org.apache.xerces.impl.dv.xs.XSSimpleTypeDelegate

All Implemented Interfaces:
  XSSimpleType, org.apache.xerces.xs.XSObject, org.apache.xerces.xs.XSSimpleTypeDefinition, org.apache.xerces.xs.XSTypeDefinition

    public class XSSimpleTypeDelegate
    extends java.lang.Object
    implements XSSimpleType

Base class for XSSimpleType wrapper implementations.

Version:
  $Id: XSSimpleTypeDelegate.java 1024038 2010-10-18 22:06:35Z sandygao $

# INTERNAL:

  Usage of this class is not supported. It may be altered or removed at any time.

### Field Summary

Fields
`protected XSSimpleType` `type`

### 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_PRECISIONDECIMAL, PRIMITIVE_QNAME, PRIMITIVE_STRING, PRIMITIVE_TIME, WS_COLLAPSE, WS_PRESERVE, WS_REPLACE`

### Fields inherited from interface org.apache.xerces.xs.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.xs.XSTypeDefinition

`COMPLEX_TYPE, SIMPLE_TYPE`

### Constructor Summary

Constructors
Constructor and Description
`XSSimpleTypeDelegate(XSSimpleType type)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)` If this type is created from restriction, then some facets can be applied to the simple type.
`boolean` `derivedFrom(java.lang.String namespace, java.lang.String name, short derivationMethod)` Convenience method which checks if this type is derived from the given ancestor type.
`boolean` `derivedFromType(org.apache.xerces.xs.XSTypeDefinition ancestorType, short derivationMethod)` Convenience method which checks if this type is derived from the given `ancestorType`.
`org.apache.xerces.xs.XSObjectList` `getAnnotations()` A sequence of [annotations] or an empty `XSObjectList`.
`boolean` `getAnonymous()` Convenience attribute.
`org.apache.xerces.xs.XSTypeDefinition` `getBaseType()` {base type definition}: either a simple type definition or a complex type definition.
`boolean` `getBounded()` Fundamental Facet: bounded.
`short` `getBuiltInKind()` Returns the closest built-in type category this type represents or derived from.
`short` `getDefinedFacets()` [facets]: all facets defined on this type.
`org.apache.xerces.xs.XSObject` `getFacet(int facetType)` A constraining facet object.
`org.apache.xerces.xs.XSObjectList` `getFacets()` A list of constraining facets if it exists, otherwise an empty `XSObjectList`.
`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]: all defined facets for this type which are fixed.
`org.apache.xerces.xs.XSSimpleTypeDefinition` `getItemType()` If variety is `list` the item type definition (an atomic or union simple type definition) is available, otherwise `null`.
`org.apache.xerces.xs.StringList` `getLexicalEnumeration()` A list of enumeration values if it exists, otherwise an empty `StringList`.
`java.lang.String` `getLexicalFacetValue(short facetName)` Convenience method.
`org.apache.xerces.xs.StringList` `getLexicalPattern()` A list of pattern values if it exists, otherwise an empty `StringList`.
`org.apache.xerces.xs.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`.
`org.apache.xerces.xs.XSObjectList` `getMultiValueFacets()` A list of enumeration and pattern constraining facets if it exists, otherwise an empty `XSObjectList`.
`java.lang.String` `getName()` 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.
`java.lang.String` `getNamespace()` The [target namespace] of this object, or `null` if it is unspecified.
`org.apache.xerces.xs.XSNamespaceItem` `getNamespaceItem()` A namespace schema information item corresponding to the target namespace of the component, if it is 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.
`org.apache.xerces.xs.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.
`XSSimpleType` `getWrappedXSSimpleType()`
`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 restriction)` {final}.
`boolean` `isFixedFacet(short facetName)` Convenience method.
`boolean` `isIDType()` Check whether this type is or is derived from ID.
`java.lang.String` `toString()`
`java.lang.Object` `validate(java.lang.Object content, ValidationContext context, ValidatedInfo validatedInfo)` validate a given string value, represented by content.toString().
`java.lang.Object` `validate(java.lang.String content, ValidationContext context, ValidatedInfo validatedInfo)` validate a given string against this simple type.
`void` `validate(ValidationContext context, ValidatedInfo validatedInfo)` Validate an actual value against this simple type.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### type

    protected final XSSimpleType type

### Constructor Detail

#### XSSimpleTypeDelegate

    public XSSimpleTypeDelegate(XSSimpleType type)

### Method Detail

#### getWrappedXSSimpleType

    public XSSimpleType getWrappedXSSimpleType()

#### getAnnotations

    public org.apache.xerces.xs.XSObjectList getAnnotations()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
A sequence of [annotations] or an empty `XSObjectList`.

Specified by:
  `getAnnotations` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getBounded

    public boolean getBounded()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
Fundamental Facet: bounded.

Specified by:
  `getBounded` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getBuiltInKind

    public short getBuiltInKind()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
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 `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getDefinedFacets

    public short getDefinedFacets()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
[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 `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getFacets

    public org.apache.xerces.xs.XSObjectList getFacets()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
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 `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getFacet

    public org.apache.xerces.xs.XSObject getFacet(int facetType)

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
A constraining facet object. An instance of XSFacet or XSMultiValueFacet.

Specified by:
  `getFacet` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getFinite

    public boolean getFinite()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
Fundamental Facet: cardinality.

Specified by:
  `getFinite` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getFixedFacets

    public short getFixedFacets()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
[facets]: all defined facets for this type which are fixed.

Specified by:
  `getFixedFacets` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getItemType

    public org.apache.xerces.xs.XSSimpleTypeDefinition getItemType()

Description copied from interface: `org.apache.xerces.xs.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 `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getLexicalEnumeration

    public org.apache.xerces.xs.StringList getLexicalEnumeration()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
A list of enumeration values if it exists, otherwise an empty `StringList`.

Specified by:
  `getLexicalEnumeration` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getLexicalFacetValue

    public java.lang.String getLexicalFacetValue(short facetName)

Description copied from interface: `org.apache.xerces.xs.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 `org.apache.xerces.xs.XSSimpleTypeDefinition`
Parameters:
  `facetName` - The name of the facet, i.e. `FACET_LENGTH, FACET_TOTALDIGITS`. 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`.

#### getLexicalPattern

    public org.apache.xerces.xs.StringList getLexicalPattern()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
A list of pattern values if it exists, otherwise an empty `StringList`.

Specified by:
  `getLexicalPattern` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getMemberTypes

    public org.apache.xerces.xs.XSObjectList getMemberTypes()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
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 `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getMultiValueFacets

    public org.apache.xerces.xs.XSObjectList getMultiValueFacets()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
A list of enumeration and pattern constraining facets if it exists, otherwise an empty `XSObjectList`.

Specified by:
  `getMultiValueFacets` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getNumeric

    public boolean getNumeric()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
Fundamental Facet: numeric.

Specified by:
  `getNumeric` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getOrdered

    public short getOrdered()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
Fundamental Facet: ordered.

Specified by:
  `getOrdered` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getPrimitiveType

    public org.apache.xerces.xs.XSSimpleTypeDefinition getPrimitiveType()

Description copied from interface: `org.apache.xerces.xs.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 `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### getVariety

    public short getVariety()

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
[variety]: one of {atomic, list, union} or absent.

Specified by:
  `getVariety` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`

#### isDefinedFacet

    public boolean isDefinedFacet(short facetName)

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
Convenience method. [Facets]: check whether a facet is defined on this type.

Specified by:
  `isDefinedFacet` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`
Parameters:
  `facetName` - The name of the facet.
Returns:
  True if the facet is defined, false otherwise.

#### isFixedFacet

    public boolean isFixedFacet(short facetName)

Description copied from interface: `org.apache.xerces.xs.XSSimpleTypeDefinition`
Convenience method. [Facets]: check whether a facet is defined and fixed on this type.

Specified by:
  `isFixedFacet` in interface `org.apache.xerces.xs.XSSimpleTypeDefinition`
Parameters:
  `facetName` - The name of the facet.
Returns:
  True if the facet is fixed, false otherwise.

#### derivedFrom

    public boolean derivedFrom(java.lang.String namespace,
                               java.lang.String name,
                               short derivationMethod)

Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
Convenience method which checks if this type is derived from the given ancestor type.

Specified by:
  `derivedFrom` in interface `org.apache.xerces.xs.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:
  True if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod` .

#### derivedFromType

    public boolean derivedFromType(org.apache.xerces.xs.XSTypeDefinition ancestorType,
                                   short derivationMethod)

Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
Convenience method which checks if this type is derived from the given `ancestorType`.

Specified by:
  `derivedFromType` in interface `org.apache.xerces.xs.XSTypeDefinition`
Parameters:
  `ancestorType` - An ancestor type definition.
  `derivationMethod` - 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` .

#### getAnonymous

    public boolean getAnonymous()

Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
Convenience attribute. A boolean that specifies if the type definition is anonymous.

Specified by:
  `getAnonymous` in interface `org.apache.xerces.xs.XSTypeDefinition`

#### getBaseType

    public org.apache.xerces.xs.XSTypeDefinition getBaseType()

Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
{base type definition}: either a simple type definition or a complex type definition.

Specified by:
  `getBaseType` in interface `org.apache.xerces.xs.XSTypeDefinition`

#### getFinal

    public short getFinal()

Description copied from interface: `org.apache.xerces.xs.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 `org.apache.xerces.xs.XSTypeDefinition`

#### getTypeCategory

    public short getTypeCategory()

Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
Return whether this type definition is a simple type or complex type.

Specified by:
  `getTypeCategory` in interface `org.apache.xerces.xs.XSTypeDefinition`

#### isFinal

    public boolean isFinal(short restriction)

Description copied from interface: `org.apache.xerces.xs.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 `org.apache.xerces.xs.XSTypeDefinition`
Parameters:
  `restriction` - Extension, restriction, list, union constants (defined in `XSConstants`).
Returns:
  True if `restriction` is in the final set, otherwise false.

#### getName

    public java.lang.String getName()

Description copied from interface: `org.apache.xerces.xs.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 `org.apache.xerces.xs.XSObject`

#### getNamespace

    public java.lang.String getNamespace()

Description copied from interface: `org.apache.xerces.xs.XSObject`
The [target namespace] of this object, or `null` if it is unspecified.

Specified by:
  `getNamespace` in interface `org.apache.xerces.xs.XSObject`

#### getNamespaceItem

    public org.apache.xerces.xs.XSNamespaceItem getNamespaceItem()

Description copied from interface: `org.apache.xerces.xs.XSObject`
A namespace schema information item corresponding to the target namespace of the component, if it is globally declared; or `null` otherwise.

Specified by:
  `getNamespaceItem` in interface `org.apache.xerces.xs.XSObject`

#### getType

    public short getType()

Description copied from interface: `org.apache.xerces.xs.XSObject`
The `type` of this object, i.e. `ELEMENT_DECLARATION`.

Specified by:
  `getType` in interface `org.apache.xerces.xs.XSObject`

#### applyFacets

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

Description copied from interface: `XSSimpleType`
If this type is created from restriction, then some facets can be applied to the simple type. `XSFacets` is used to pass the value of different facets.

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.

#### 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

#### 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

#### 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`
Parameters:
  `value1` - the first value
  `value2` - the second value
Returns:
  true if the two value are equal

#### 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.

#### validate

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

Description copied from interface: `XSSimpleType`
Validate an actual value against this simple type.

Specified by:
  `validate` in interface `XSSimpleType`
Parameters:
  `context` - the validation context
  `validatedInfo` - used to provide the actual value and member types
Throws:
  `InvalidDatatypeValueException` - exception for invalid values.

#### validate

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

Description copied from interface: `XSSimpleType`
validate a given string against this simple type.

Specified by:
  `validate` in interface `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
Throws:
  `InvalidDatatypeValueException`

#### validate

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

Description copied from interface: `XSSimpleType`
validate a given string value, represented by content.toString(). note that if content is a StringBuffer, for performance reasons, it's possible that the content of the string buffer is modified.

Specified by:
  `validate` in interface `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
Throws:
  `InvalidDatatypeValueException`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`