Top Description Fields Constructors Methods
com.sun.msv.datatype.xsd

public abstract Class DataTypeWithFacet

extends XSDatatypeImpl
Class Inheritance
Known Direct Subclasses
com.sun.msv.datatype.xsd.DataTypeWithLexicalConstraintFacet, com.sun.msv.datatype.xsd.DataTypeWithValueConstraintFacet, com.sun.msv.datatype.xsd.WhiteSpaceFacet
Imports
com.sun.msv.datatype.SerializationContext, org.relaxng.datatype.DatatypeException, .ValidationContext

Base implementation of facet-restricted datatype
Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
public final XSDatatypeImpl
baseType

immediate base type, which may be a concrete type or DataTypeWithFacet

protected final ConcreteType
concreteType

base concrete type

public final String
facetName

name of this facet

public final boolean
isFacetFixed

a flag that indicates the facet is fixed (derived types cannot specify this value anymore)

private final boolean
needValueCheckFlag

a flag that indicates this type has value-constraint facet.

private static final long
Inherited from com.sun.msv.datatype.xsd.XSDatatypeImpl:
ERR_DUPLICATE_FACETERR_EMPTY_UNIONERR_ENUMERATIONERR_ENUMERATION_WITH_ARGERR_FACET_MUST_BE_NON_NEGATIVE_INTEGERERR_FACET_MUST_BE_POSITIVE_INTEGERERR_INAPPROPRIATE_FOR_TYPEERR_INCONSISTENT_FACETS_1ERR_INCONSISTENT_FACETS_2ERR_INVALID_BASE_TYPEERR_INVALID_ITEMTYPEERR_INVALID_MEMBER_TYPEERR_INVALID_VALUE_FOR_THIS_TYPEERR_INVALID_WHITESPACE_VALUEERR_LENGTHERR_LOOSENED_FACETERR_MAXLENGTHERR_MINLENGTHERR_NOT_APPLICABLE_FACETERR_OUT_OF_RANGEERR_OVERRIDING_FIXED_FACETERR_PARSE_ERRORERR_PATTERN_1ERR_PATTERN_MANYERR_SCALE_IS_GREATER_THAN_PRECISIONERR_TOO_MUCH_PRECISIONERR_TOO_MUCH_SCALEERR_X_AND_Y_ARE_EXCLUSIVEserializedValueCheckerwhiteSpace

Constructor Summary

AccessConstructor and Description
pack-priv
DataTypeWithFacet(String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed)

constructor for facets other than WhiteSpaceFacet

pack-priv
DataTypeWithFacet(String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed, WhiteSpaceProcessor whiteSpace)

constructor for WhiteSpaceFacet

Method Summary

Modifier and TypeMethod and Description
protected final void
_checkValid(String content, ValidationContext context)

Implements abstract com.sun.msv.datatype.xsd.XSDatatypeImpl._checkValid.

actual 'meat' of the checkValid method
public final Object
public final String
convertToLexicalValue(Object o, SerializationContext
Context information that will be possibly used for the conversion. Currently, this object is used only by QName, but may be extended in the future.
context
)

Implements com.sun.msv.datatype.xsd.XSDatatype.convertToLexicalValue.

converts value object back to the corresponding value in the lexical space.
protected abstract void
public final String
displayName()

Implements com.sun.msv.datatype.xsd.XSDatatype.displayName.

gets the displayable name of this type.
public final XSDatatype
getBaseType()

Implements com.sun.msv.datatype.xsd.XSDatatype.getBaseType.

gets the base type of this type.
public final ConcreteType
getConcreteType()

Implements abstract com.sun.msv.datatype.xsd.XSDatatypeImpl.getConcreteType.

gets the concrete type object of the restriction chain.
public final DataTypeWithFacet
getFacetObject(String facetName)

Overrides com.sun.msv.datatype.xsd.XSDatatypeImpl.getFacetObject.

Implements com.sun.msv.datatype.xsd.XSDatatype.getFacetObject.

gets the facet object that restricts the specified facet
public int
getIdType()

Overrides com.sun.msv.datatype.xsd.XSDatatypeImpl.getIdType.

Implements org.relaxng.datatype.Datatype.getIdType.

A property for RELAX NG DTD compatibility datatypes.
public final Class<T>
getJavaObjectType()

Implements com.sun.msv.datatype.DatabindableDatatype.getJavaObjectType.

gets the type of the objects that are created by the createJavaObject method.
public final int
getVariety()

Implements com.sun.msv.datatype.xsd.XSDatatype.getVariety.

gets the variety of this simple type.
public boolean
public final int
isFacetApplicable(String facetName)

Implements com.sun.msv.datatype.xsd.XSDatatype.isFacetApplicable.

returns if the specified facet is applicable to this datatype.
public final boolean
isFinal(int
one of pre-defined values (DERIVATION_BY_XXX).
derivationType
)

Implements com.sun.msv.datatype.xsd.XSDatatype.isFinal.

checks if this type is declared as final for the specified kind of derivation.
protected boolean
public String
serializeJavaObject(Object value, SerializationContext
The context object is used to obtain information necessary to serialize the value object. For example, QName type uses the context to encode the URI into a prefix.
context
)

Implements com.sun.msv.datatype.DatabindableDatatype.serializeJavaObject.

converts a value object back to the lexical representation.
Inherited from com.sun.msv.datatype.xsd.XSDatatypeImpl:
_createValuecheckFormatcheckValidcreateJavaObjectcreateStreamingValidatorcreateValuegetAncestorBuiltinTypegetApplicableFacetNamesgetNamegetNamespaceUriisAlwaysValidisDerivedTypeOfisDerivedTypeOfisValidlocalizelocalizelocalizelocalizelocalizesameValuevalueHashCode

Field Detail

baseTypeback to summary
public final XSDatatypeImpl baseType

immediate base type, which may be a concrete type or DataTypeWithFacet

concreteTypeback to summary
protected final ConcreteType concreteType

base concrete type

facetNameback to summary
public final String facetName

name of this facet

isFacetFixedback to summary
public final boolean isFacetFixed

a flag that indicates the facet is fixed (derived types cannot specify this value anymore)

needValueCheckFlagback to summary
private final boolean needValueCheckFlag

a flag that indicates this type has value-constraint facet. this value is used to cache this flag.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.sun.msv.datatype.xsd.XSDatatypeImpl.serialVersionUID.

Constructor Detail

DataTypeWithFacetback to summary
pack-priv DataTypeWithFacet(String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed) throws DatatypeException

constructor for facets other than WhiteSpaceFacet

DataTypeWithFacetback to summary
pack-priv DataTypeWithFacet(String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed, WhiteSpaceProcessor whiteSpace) throws DatatypeException

constructor for WhiteSpaceFacet

Method Detail

_checkValidback to summary
protected final void _checkValid(String content, ValidationContext context) throws DatatypeException

Implements abstract com.sun.msv.datatype.xsd.XSDatatypeImpl._checkValid.

Doc from com.sun.msv.datatype.xsd.XSDatatypeImpl._checkValid.

actual 'meat' of the checkValid method

_createJavaObjectback to summary
public final Object _createJavaObject(String literal, ValidationContext context)

Implements abstract com.sun.msv.datatype.xsd.XSDatatypeImpl._createJavaObject.

convertToLexicalValueback to summary
public final String convertToLexicalValue(Object o, SerializationContext context)

Implements com.sun.msv.datatype.xsd.XSDatatype.convertToLexicalValue.

Doc from com.sun.msv.datatype.xsd.XSDatatype.convertToLexicalValue.

converts value object back to the corresponding value in the lexical space.

This method does the reverse operation of the createValue method. The returned string is not necessarily the canonical representation. Also note that the implementation may accept invalid values without throwing IllegalArgumentException. To make sure that the result is actually a valid representation, call the isValid method.

Be careful not to confuse this method with The serializeJavaObject method, which is defined in the DatabindableDatatype method.

Parameters
context:SerializationContext

Context information that will be possibly used for the conversion. Currently, this object is used only by QName, but may be extended in the future.

diagnoseByFacetback to summary
protected abstract void diagnoseByFacet(String content, ValidationContext context) throws DatatypeException
displayNameback to summary
public final String displayName()

Implements com.sun.msv.datatype.xsd.XSDatatype.displayName.

Doc from com.sun.msv.datatype.xsd.XSDatatype.displayName.

gets the displayable name of this type. This method always return something. It is useful to provide a message to the user.

This method is an ad-hoc method and there is no corresponding property in the spec.

getBaseTypeback to summary
public final XSDatatype getBaseType()

Implements com.sun.msv.datatype.xsd.XSDatatype.getBaseType.

Doc from com.sun.msv.datatype.xsd.XSDatatype.getBaseType.

gets the base type of this type. This method returns null if this object represents the simple ur-type.

This method is intended to capture the semantics of the base type definition property of the simple type component, but there is an important difference.

Specifically, if you derive a type D from another type B, then calling D.getBaseType() does not necessarily return B. Instead, it may return an intermediate object (that represents a facet). Calling the getBaseType method recursively will eventually return B.

getConcreteTypeback to summary
public final ConcreteType getConcreteType()

Implements abstract com.sun.msv.datatype.xsd.XSDatatypeImpl.getConcreteType.

Doc from com.sun.msv.datatype.xsd.XSDatatypeImpl.getConcreteType.

gets the concrete type object of the restriction chain.

getFacetObjectback to summary
public final DataTypeWithFacet getFacetObject(String facetName)

Overrides com.sun.msv.datatype.xsd.XSDatatypeImpl.getFacetObject.

Implements com.sun.msv.datatype.xsd.XSDatatype.getFacetObject.

Doc from com.sun.msv.datatype.xsd.XSDatatypeImpl.getFacetObject.

gets the facet object that restricts the specified facet

Returns:DataTypeWithFacet

null if no such facet object exists.

getIdTypeback to summary
public int getIdType()

Overrides com.sun.msv.datatype.xsd.XSDatatypeImpl.getIdType.

Implements org.relaxng.datatype.Datatype.getIdType.

Doc from com.sun.msv.datatype.xsd.XSDatatypeImpl.getIdType.

A property for RELAX NG DTD compatibility datatypes. ID_TYPE_NULL is returned by default.

Returns:int

Doc from org.relaxng.datatype.Datatype.getIdType.

If this datatype doesn't have any ID/IDREF semantics, it returns ID_TYPE_NULL. If it has such a semantics (for example, XSD:ID, XSD:IDREF and comp:ID type), then it returns ID_TYPE_ID, ID_TYPE_IDREF or ID_TYPE_IDREFS.

getJavaObjectTypeback to summary
public final Class<T> getJavaObjectType()

Implements com.sun.msv.datatype.DatabindableDatatype.getJavaObjectType.

Doc from com.sun.msv.datatype.DatabindableDatatype.getJavaObjectType.

gets the type of the objects that are created by the createJavaObject method.

getVarietyback to summary
public final int getVariety()

Implements com.sun.msv.datatype.xsd.XSDatatype.getVariety.

Doc from com.sun.msv.datatype.xsd.XSDatatype.getVariety.

gets the variety of this simple type.

Returns:int

VARIETY_ATOMIC, VARIETY_LIST, or VARIETY_UNION.

isContextDependentback to summary
public boolean isContextDependent()

Overrides com.sun.msv.datatype.xsd.XSDatatypeImpl.isContextDependent.

Implements org.relaxng.datatype.Datatype.isContextDependent.

Doc from com.sun.msv.datatype.xsd.XSDatatypeImpl.isContextDependent.

A property for RELAX NG DTD compatibility datatypes. Context-independent by default.

Returns:boolean

Doc from org.relaxng.datatype.Datatype.isContextDependent.

true if this datatype is context-dependent (it needs a context object sometimes); false if this datatype is context-independent (it never needs a context object).

isFacetApplicableback to summary
public final int isFacetApplicable(String facetName)

Implements com.sun.msv.datatype.xsd.XSDatatype.isFacetApplicable.

Doc from com.sun.msv.datatype.xsd.XSDatatype.isFacetApplicable.

returns if the specified facet is applicable to this datatype.

Returns:int

APPLICABLE
if the facet is applicable
FIXED
if the facet is already fixed (that is,not applicable)
NOT_ALLOWED
if the facet is not applicable to this datatype at all. this value is also returned for unknown facets.
isFinalback to summary
public final boolean isFinal(int derivationType)

Implements com.sun.msv.datatype.xsd.XSDatatype.isFinal.

Doc from com.sun.msv.datatype.xsd.XSDatatype.isFinal.

checks if this type is declared as final for the specified kind of derivation.

In the terminology of the spec, this method can be used to examine the final property of this component.

Parameters
derivationType:int

one of pre-defined values (DERIVATION_BY_XXX).

needValueCheckback to summary
protected boolean needValueCheck()

Overrides com.sun.msv.datatype.xsd.XSDatatypeImpl.needValueCheck.

serializeJavaObjectback to summary
public String serializeJavaObject(Object value, SerializationContext context)

Implements com.sun.msv.datatype.DatabindableDatatype.serializeJavaObject.

Doc from com.sun.msv.datatype.DatabindableDatatype.serializeJavaObject.

converts a value object back to the lexical representation.

This method is a kind of the "reverse" function of the createJavaObject method.

Parameters
context:SerializationContext

The context object is used to obtain information necessary to serialize the value object. For example, QName type uses the context to encode the URI into a prefix.

Returns:String

null if the given object is invalid with respect to this datatype.