Package org.exolab.castor.xml.schema
Class Facet
java.lang.Object
org.exolab.castor.xml.schema.Structure
org.exolab.castor.xml.schema.Annotated
org.exolab.castor.xml.schema.Facet
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MaxExclusive
,MaxInclusive
,MinExclusive
,MinInclusive
Represents the base type for XML Schema Facets
- Version:
- $Revision$ $Date: 2005-12-13 14:58:48 -0700 (Tue, 13 Dec 2005) $
- Author:
- Keith Visco
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.exolab.castor.xml.schema.Structure
ANNOTATION, ANYTYPE, APPINFO, ATTRIBUTE, ATTRIBUTE_GROUP, COMPLEX_CONTENT, COMPLEX_TYPE, DOCUMENTATION, ELEMENT, FACET, GROUP, IDENTITY_FIELD, IDENTITY_SELECTOR, KEY, KEYREF, LIST, MODELGROUP, MODELGROUP_REF, REDEFINE, SCHEMA, SIMPLE_CONTENT, SIMPLE_TYPE, UNION, UNIQUE, UNKNOWN, WILDCARD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkConstraints
(Enumeration localFacets, Enumeration baseFacets) Checks the constraints on the current facet against the other local facets of the same derived data type and facets of the base data type.getName()
Returns the name of this Facet.Returns the owningSimpleType
instance.short
Returns the type of this Schema Structure.getValue()
Returns the character (String) representation of this facet.boolean
Returns true if this Facet can occur more than once, such as the "enumeration" facet.boolean
overridesBase
(Facet baseFacet) Checks whether the current facet overrides a facet of the base data type.void
setOwningType
(SimpleType owningType) Sets the owningSimpleType
instance.Returns aBigDecimal
representation of the value of this facet.byte
toByte()
Returns a byte representation of the value of this facet.double
toDouble()
Returns a double representation of the value of this facet.float
toFloat()
Returns a double representation of the value of this facet.int
toInt()
Returns an int representation of the value of this facet.long
toLong()
Returns a long representation of the value of this facet.short
toShort()
Returns an short representation of the value of this facet.void
validate()
Checks the validity of this Schema defintion.Methods inherited from class org.exolab.castor.xml.schema.Annotated
addAnnotation, getAnnotations, removeAnnotation
-
Field Details
-
ENUMERATION
- See Also:
-
LENGTH
- See Also:
-
PATTERN
- See Also:
-
PRECISION
- See Also:
-
MAX_EXCLUSIVE
- See Also:
-
MAX_INCLUSIVE
- See Also:
-
MIN_EXCLUSIVE
- See Also:
-
MIN_INCLUSIVE
- See Also:
-
MAX_LENGTH
- See Also:
-
MIN_LENGTH
- See Also:
-
WHITESPACE
- See Also:
-
TOTALDIGITS
- See Also:
-
FRACTIONDIGITS
- See Also:
-
WHITESPACE_PRESERVE
- See Also:
-
WHITESPACE_REPLACE
- See Also:
-
WHITESPACE_COLLAPSE
- See Also:
-
-
Constructor Details
-
Facet
-
-
Method Details
-
getName
-
getValue
Returns the character (String) representation of this facet.- Returns:
- the value of this facet
-
isMultivalued
public boolean isMultivalued()Returns true if this Facet can occur more than once, such as the "enumeration" facet.- Returns:
- true if this Facet can occur more than once.
-
toInt
Returns an int representation of the value of this facet.- Returns:
- an int representation of the value of this facet
- Throws:
NumberFormatException
- if the value fails to parse as a int.
-
toLong
Returns a long representation of the value of this facet.- Returns:
- a long representation of the value of this facet
- Throws:
NumberFormatException
- if the value fails to parse as a long.
-
toShort
Returns an short representation of the value of this facet.- Returns:
- an short representation of the value of this facet
- Throws:
NumberFormatException
- if the value fails to parse as a short.
-
toFloat
Returns a double representation of the value of this facet.- Returns:
- a double representation of the value of this facet
- Throws:
NumberFormatException
- if the value fails to parse as a float.
-
toDouble
Returns a double representation of the value of this facet.- Returns:
- a double representation of the value of this facet
- Throws:
NumberFormatException
- if the value fails to parse as a double.
-
toByte
Returns a byte representation of the value of this facet.- Returns:
- a byte representation of the value of this facet
- Throws:
NumberFormatException
- if the value fails to parse as a byte.
-
toBigDecimal
Returns aBigDecimal
representation of the value of this facet.- Returns:
- a
BigDecimal
representation of the value of this facet - Throws:
NumberFormatException
- if the value cannot be parsed as number
-
getStructureType
public short getStructureType()Returns the type of this Schema Structure.- Specified by:
getStructureType
in classStructure
- Returns:
- the type of this Schema Structure
-
validate
Checks the validity of this Schema defintion.- Specified by:
validate
in classStructure
- Throws:
ValidationException
- when this Schema definition is invalid.
-
overridesBase
Checks whether the current facet overrides a facet of the base data type. This does generally happen when a data type is derived by restriction and it therefore has facet(s), which are more restrictive than the ones of the base data type.This method is used for merging facets of the base and derived types, in order to create an effective set of facets for the derived type.
It's important to note that this method does not perform any validity checks. Validation must be generally performed before trying to merge facets of the base and derived types.
- Parameters:
baseFacet
- a facet of the base data type- Returns:
true
, if the current facet overridesbaseFacet
;false
, otherwise.- See Also:
-
checkConstraints
public void checkConstraints(Enumeration localFacets, Enumeration baseFacets) throws SchemaException Checks the constraints on the current facet against the other local facets of the same derived data type and facets of the base data type. Validation is performed according to the rules defined in "XML Schema Part 2: Datatypes Second Edition" document.- Parameters:
localFacets
- local facets of the data typebaseFacets
- merged facets of the base data type- Throws:
SchemaException
- when the current facet does not satisfy schema component validation constraints
-
setOwningType
Sets the owningSimpleType
instance.- Parameters:
owningType
- The owningSimpleType
instance.
-
getOwningType
Returns the owningSimpleType
instance.- Returns:
- The owning
SimpleType
instance.
-