Class XSSimpleTypeDelegate
- java.lang.Object
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dv.xs.XSSimpleTypeDelegate
-
- All Implemented Interfaces:
XSSimpleType,XSObject,XSSimpleTypeDefinition,XSTypeDefinition
public class XSSimpleTypeDelegate extends Object implements XSSimpleType
Base class for XSSimpleType wrapper implementations.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description protected XSSimpleTypetype-
Fields inherited from interface org.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.org.apache.xerces.xs.XSTypeDefinition
COMPLEX_TYPE, SIMPLE_TYPE
-
-
Constructor Summary
Constructors Constructor Description XSSimpleTypeDelegate(XSSimpleType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyFacets(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.booleanderivedFrom(String namespace, String name, short derivationMethod)Convenience method which checks if this type is derived from the given ancestor type.booleanderivedFromType(XSTypeDefinition ancestorType, short derivationMethod)Convenience method which checks if this type is derived from the givenancestorType.XSObjectListgetAnnotations()A sequence of [annotations] or an emptyXSObjectList.booleangetAnonymous()Convenience attribute.XSTypeDefinitiongetBaseType(){base type definition}: either a simple type definition or a complex type definition.booleangetBounded()Fundamental Facet: bounded.shortgetBuiltInKind()Returns the closest built-in type category this type represents or derived from.shortgetDefinedFacets()[facets]: all facets defined on this type.XSObjectgetFacet(int facetType)A constraining facet object.XSObjectListgetFacets()A list of constraining facets if it exists, otherwise an emptyXSObjectList.shortgetFinal()For complex types the returned value is a bit combination of the subset of {DERIVATION_EXTENSION, DERIVATION_RESTRICTION} corresponding tofinalset of this type orDERIVATION_NONE.booleangetFinite()Fundamental Facet: cardinality.shortgetFixedFacets()[facets]: all defined facets for this type which are fixed.XSSimpleTypeDefinitiongetItemType()If variety islistthe item type definition (an atomic or union simple type definition) is available, otherwisenull.StringListgetLexicalEnumeration()A list of enumeration values if it exists, otherwise an emptyStringList.StringgetLexicalFacetValue(short facetName)Convenience method.StringListgetLexicalPattern()A list of pattern values if it exists, otherwise an emptyStringList.XSObjectListgetMemberTypes()If variety isunionthe list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise an emptyXSObjectList.XSObjectListgetMultiValueFacets()A list of enumeration and pattern constraining facets if it exists, otherwise an emptyXSObjectList.StringgetName()The name of typeNCName, as defined in XML Namespaces, of this declaration specified in the{name}property of the component ornullif the definition of this component does not have a{name}property.StringgetNamespace()The [target namespace] of this object, ornullif it is unspecified.XSNamespaceItemgetNamespaceItem()A namespace schema information item corresponding to the target namespace of the component, if it is globally declared; ornullotherwise.booleangetNumeric()Fundamental Facet: numeric.shortgetOrdered()Fundamental Facet: ordered.shortgetPrimitiveKind()return an ID representing the built-in primitive base type.XSSimpleTypeDefinitiongetPrimitiveType()If variety isatomicthe primitive type definition (a built-in primitive datatype definition or the simple ur-type definition) is available, otherwisenull.shortgetType()Thetypeof this object, i.e.shortgetTypeCategory()Return whether this type definition is a simple type or complex type.shortgetVariety()[variety]: one of {atomic, list, union} or absent.shortgetWhitespace()Return the whitespace corresponding to this datatype.XSSimpleTypegetWrappedXSSimpleType()booleanisDefinedFacet(short facetName)Convenience method.booleanisEqual(Object value1, Object value2)Check whether two actual values are equal.booleanisFinal(short restriction){final}.booleanisFixedFacet(short facetName)Convenience method.booleanisIDType()Check whether this type is or is derived from ID.StringtoString()Objectvalidate(Object content, ValidationContext context, ValidatedInfo validatedInfo)validate a given string value, represented by content.toString().Objectvalidate(String content, ValidationContext context, ValidatedInfo validatedInfo)validate a given string against this simple type.voidvalidate(ValidationContext context, ValidatedInfo validatedInfo)Validate an actual value against this simple type.
-
-
-
Field Detail
-
type
protected final XSSimpleType type
-
-
Constructor Detail
-
XSSimpleTypeDelegate
public XSSimpleTypeDelegate(XSSimpleType type)
-
-
Method Detail
-
getWrappedXSSimpleType
public XSSimpleType getWrappedXSSimpleType()
-
getAnnotations
public XSObjectList getAnnotations()
Description copied from interface:XSSimpleTypeDefinitionA sequence of [annotations] or an emptyXSObjectList.- Specified by:
getAnnotationsin interfaceXSSimpleTypeDefinition
-
getBounded
public boolean getBounded()
Description copied from interface:XSSimpleTypeDefinitionFundamental Facet: bounded.- Specified by:
getBoundedin interfaceXSSimpleTypeDefinition
-
getBuiltInKind
public short getBuiltInKind()
Description copied from interface:XSSimpleTypeDefinitionReturns 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 theINTEGER_DVis returned.- Specified by:
getBuiltInKindin interfaceXSSimpleTypeDefinition
-
getDefinedFacets
public short getDefinedFacets()
Description copied from interface:XSSimpleTypeDefinition[facets]: all facets defined on this type. The value is a bit combination of FACET_XXX constants of all defined facets.- Specified by:
getDefinedFacetsin interfaceXSSimpleTypeDefinition
-
getFacets
public XSObjectList getFacets()
Description copied from interface:XSSimpleTypeDefinitionA list of constraining facets if it exists, otherwise an emptyXSObjectList. Note: This method must not be used to retrieve values forenumerationandpatternfacets.- Specified by:
getFacetsin interfaceXSSimpleTypeDefinition
-
getFacet
public XSObject getFacet(int facetType)
Description copied from interface:XSSimpleTypeDefinitionA constraining facet object. An instance of XSFacet or XSMultiValueFacet.- Specified by:
getFacetin interfaceXSSimpleTypeDefinition
-
getFinite
public boolean getFinite()
Description copied from interface:XSSimpleTypeDefinitionFundamental Facet: cardinality.- Specified by:
getFinitein interfaceXSSimpleTypeDefinition
-
getFixedFacets
public short getFixedFacets()
Description copied from interface:XSSimpleTypeDefinition[facets]: all defined facets for this type which are fixed.- Specified by:
getFixedFacetsin interfaceXSSimpleTypeDefinition
-
getItemType
public XSSimpleTypeDefinition getItemType()
Description copied from interface:XSSimpleTypeDefinitionIf variety islistthe item type definition (an atomic or union simple type definition) is available, otherwisenull.- Specified by:
getItemTypein interfaceXSSimpleTypeDefinition
-
getLexicalEnumeration
public StringList getLexicalEnumeration()
Description copied from interface:XSSimpleTypeDefinitionA list of enumeration values if it exists, otherwise an emptyStringList.- Specified by:
getLexicalEnumerationin interfaceXSSimpleTypeDefinition
-
getLexicalFacetValue
public String getLexicalFacetValue(short facetName)
Description copied from interface:XSSimpleTypeDefinitionConvenience method. Returns a value of a single constraining facet for this simple type definition. This method must not be used to retrieve values forenumerationandpatternfacets.- Specified by:
getLexicalFacetValuein interfaceXSSimpleTypeDefinition- Parameters:
facetName- The name of the facet, i.e.FACET_LENGTH, FACET_TOTALDIGITS. To retrieve the value for a pattern or an enumeration, seeenumerationandpattern.- Returns:
- A value of the facet specified in
facetNamefor this simple type definition ornull.
-
getLexicalPattern
public StringList getLexicalPattern()
Description copied from interface:XSSimpleTypeDefinitionA list of pattern values if it exists, otherwise an emptyStringList.- Specified by:
getLexicalPatternin interfaceXSSimpleTypeDefinition
-
getMemberTypes
public XSObjectList getMemberTypes()
Description copied from interface:XSSimpleTypeDefinitionIf variety isunionthe list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise an emptyXSObjectList.- Specified by:
getMemberTypesin interfaceXSSimpleTypeDefinition
-
getMultiValueFacets
public XSObjectList getMultiValueFacets()
Description copied from interface:XSSimpleTypeDefinitionA list of enumeration and pattern constraining facets if it exists, otherwise an emptyXSObjectList.- Specified by:
getMultiValueFacetsin interfaceXSSimpleTypeDefinition
-
getNumeric
public boolean getNumeric()
Description copied from interface:XSSimpleTypeDefinitionFundamental Facet: numeric.- Specified by:
getNumericin interfaceXSSimpleTypeDefinition
-
getOrdered
public short getOrdered()
Description copied from interface:XSSimpleTypeDefinitionFundamental Facet: ordered.- Specified by:
getOrderedin interfaceXSSimpleTypeDefinition
-
getPrimitiveType
public XSSimpleTypeDefinition getPrimitiveType()
Description copied from interface:XSSimpleTypeDefinitionIf variety isatomicthe primitive type definition (a built-in primitive datatype definition or the simple ur-type definition) is available, otherwisenull.- Specified by:
getPrimitiveTypein interfaceXSSimpleTypeDefinition
-
getVariety
public short getVariety()
Description copied from interface:XSSimpleTypeDefinition[variety]: one of {atomic, list, union} or absent.- Specified by:
getVarietyin interfaceXSSimpleTypeDefinition
-
isDefinedFacet
public boolean isDefinedFacet(short facetName)
Description copied from interface:XSSimpleTypeDefinitionConvenience method. [Facets]: check whether a facet is defined on this type.- Specified by:
isDefinedFacetin interfaceXSSimpleTypeDefinition- 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:XSSimpleTypeDefinitionConvenience method. [Facets]: check whether a facet is defined and fixed on this type.- Specified by:
isFixedFacetin interfaceXSSimpleTypeDefinition- Parameters:
facetName- The name of the facet.- Returns:
- True if the facet is fixed, false otherwise.
-
derivedFrom
public boolean derivedFrom(String namespace, String name, short derivationMethod)
Description copied from interface:XSTypeDefinitionConvenience method which checks if this type is derived from the given ancestor type.- Specified by:
derivedFromin interfaceXSTypeDefinition- 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
ancestorTypeusing only derivation methods from thederivationMethod.
-
derivedFromType
public boolean derivedFromType(XSTypeDefinition ancestorType, short derivationMethod)
Description copied from interface:XSTypeDefinitionConvenience method which checks if this type is derived from the givenancestorType.- Specified by:
derivedFromTypein interfaceXSTypeDefinition- 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
ancestorTypeusing only derivation methods from thederivationMethod.
-
getAnonymous
public boolean getAnonymous()
Description copied from interface:XSTypeDefinitionConvenience attribute. A boolean that specifies if the type definition is anonymous.- Specified by:
getAnonymousin interfaceXSTypeDefinition
-
getBaseType
public XSTypeDefinition getBaseType()
Description copied from interface:XSTypeDefinition{base type definition}: either a simple type definition or a complex type definition.- Specified by:
getBaseTypein interfaceXSTypeDefinition
-
getFinal
public short getFinal()
Description copied from interface:XSTypeDefinitionFor complex types the returned value is a bit combination of the subset of {DERIVATION_EXTENSION, DERIVATION_RESTRICTION} corresponding tofinalset of this type orDERIVATION_NONE. For simple types the returned value is a bit combination of the subset of {DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST} corresponding tofinalset of this type orDERIVATION_NONE.- Specified by:
getFinalin interfaceXSTypeDefinition
-
getTypeCategory
public short getTypeCategory()
Description copied from interface:XSTypeDefinitionReturn whether this type definition is a simple type or complex type.- Specified by:
getTypeCategoryin interfaceXSTypeDefinition
-
isFinal
public boolean isFinal(short restriction)
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:
isFinalin interfaceXSTypeDefinition- Parameters:
restriction- Extension, restriction, list, union constants (defined inXSConstants).- Returns:
- True if
restrictionis in the final set, otherwise false.
-
getName
public String getName()
Description copied from interface:XSObjectThe name of typeNCName, as defined in XML Namespaces, of this declaration specified in the{name}property of the component ornullif 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.
-
getNamespace
public String getNamespace()
Description copied from interface:XSObjectThe [target namespace] of this object, ornullif it is unspecified.- Specified by:
getNamespacein interfaceXSObject
-
getNamespaceItem
public XSNamespaceItem getNamespaceItem()
Description copied from interface:XSObjectA namespace schema information item corresponding to the target namespace of the component, if it is globally declared; ornullotherwise.- Specified by:
getNamespaceItemin interfaceXSObject
-
getType
public short getType()
Description copied from interface:XSObjectThetypeof this object, i.e.ELEMENT_DECLARATION.
-
applyFacets
public void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context) throws InvalidDatatypeFacetException
Description copied from interface:XSSimpleTypeIf this type is created from restriction, then some facets can be applied to the simple type.XSFacetsis used to pass the value of different facets.- Specified by:
applyFacetsin interfaceXSSimpleType- Parameters:
facets- the value of all the facetspresentFacet- 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:XSSimpleTypereturn 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:
getPrimitiveKindin interfaceXSSimpleType- Returns:
- an ID representing the built-in primitive base type
-
getWhitespace
public short getWhitespace() throws DatatypeExceptionDescription copied from interface:XSSimpleTypeReturn the whitespace corresponding to this datatype.- Specified by:
getWhitespacein interfaceXSSimpleType- 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(Object value1, Object value2)
Description copied from interface:XSSimpleTypeCheck whether two actual values are equal.- Specified by:
isEqualin interfaceXSSimpleType- Parameters:
value1- the first valuevalue2- the second value- Returns:
- true if the two value are equal
-
isIDType
public boolean isIDType()
Description copied from interface:XSSimpleTypeCheck 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:
isIDTypein interfaceXSSimpleType- 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:XSSimpleTypeValidate an actual value against this simple type.- Specified by:
validatein interfaceXSSimpleType- Parameters:
context- the validation contextvalidatedInfo- used to provide the actual value and member types- Throws:
InvalidDatatypeValueException- exception for invalid values.
-
validate
public Object validate(String content, ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException
Description copied from interface:XSSimpleTypevalidate a given string against this simple type.- Specified by:
validatein interfaceXSSimpleType- Parameters:
content- the string value that needs to be validatedcontext- the validation contextvalidatedInfo- used to store validation result- Returns:
- the actual value (QName, Boolean) of the string value
- Throws:
InvalidDatatypeValueException
-
validate
public Object validate(Object content, ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException
Description copied from interface:XSSimpleTypevalidate 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:
validatein interfaceXSSimpleType- Parameters:
content- the string value that needs to be validatedcontext- the validation contextvalidatedInfo- used to store validation result- Returns:
- the actual value (QName, Boolean) of the string value
- Throws:
InvalidDatatypeValueException
-
-