Package org.exolab.castor.xml.schema
Class SimpleType
- java.lang.Object
-
- org.exolab.castor.xml.schema.Structure
-
- org.exolab.castor.xml.schema.Annotated
-
- org.exolab.castor.xml.schema.XMLType
-
- org.exolab.castor.xml.schema.SimpleType
-
- All Implemented Interfaces:
java.io.Serializable,Referable
- Direct Known Subclasses:
AtomicType,DeferredSimpleType,ListType,SimpleTypeReference,Union,UrType
public abstract class SimpleType extends XMLType implements Referable
An XML Schema SimpleType.- Version:
- $Revision: 8667 $ $Date: 2006-04-13 06:47:36 -0600 (Thu, 13 Apr 2006) $
- Author:
- Keith Visco
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFINAL_ALLThe value of the final attribute used for blocking all types of derivation.static java.lang.StringFINAL_LISTThe value of the final attribute used for blocking list derivation.static java.lang.StringFINAL_RESTRICTIONThe value of the final attribute used for blocking restriction derivation.static java.lang.StringFINAL_UNIONThe value of the final attribute used for blocking union derivation.-
Fields inherited from class org.exolab.castor.xml.schema.XMLType
NULL_ARGUMENT
-
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 Constructor Description SimpleType()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFacet(Facet facet)Adds the given Facet to this Simpletype.protected voidcopyFacets(SimpleType target)Copy this type's facets to the target type.protected SimpleTypecreateReference(java.lang.String name)A helper method for classes which extend SimpleType.SimpleTypegetBuiltInBaseType()Returns the built in type this type is derived from.java.util.Enumeration<Facet>getEffectiveFacets()Returns an enumeration of the effective facets for this type.FacetgetFacet(java.lang.String name)Returns the first facet associated with the given name.java.util.Enumeration<Facet>getFacets()Returns an Enumeration of all the Facets (including inherited) facets for this type.java.util.Enumeration<Facet>getFacets(java.lang.String name)Returns the facets associated with the given name.java.lang.StringgetFinal()Returns the value of the 'final' property, indicating which types of derivation are not allowed, or null if the final property has not been set.java.lang.LonggetLength()Returns the value of the length facet result can be nulljava.util.Enumeration<Facet>getLocalFacets()Returns the facets of this type (without the parent's facets).java.lang.LonggetMaxLength()Returns the value of the maxlength facet result can be nulljava.lang.LonggetMinLength()Returns the value of the minlength facet result can be nullintgetNumberOfFacets(java.lang.String name)Returns the number of facets named 'name' within the list of facets of this simple type.StructuregetParent()Returns the parent Structure that contains this SimpleType.java.lang.StringgetReferenceId()Returns the Id used to Refer to this Object.shortgetStructureType()Returns the type of this Schema StructureintgetTypeCode()Gets the code for this simple type.booleanhasFacet(java.lang.String name)Returns true if thisSimpleTypehas a specifiedFacetwith the given name.booleanisBuiltInType()Returns true if this SimpleType is a built in type.booleanisDateTimeType()Indicates whether thisSimpleTypeis a date/time type.booleanisNumericType()Indicates whether thisSimpleTypeis a numeric type.booleanisRedefined()Returns true if this simpleType is a redefinition.booleanremoveFacet(java.lang.String name)Removes the facet with the given name from this SimpleType.booleanremoveFacet(Facet facet)Removes the given Facet from this SimpleType.protected static SimpleTyperesolveReference(SimpleType simpleType)A helper method for classes which extend SimpleType.voidsetFinal(java.lang.String finalValue)Sets the value of the 'final' property, indicating which types of derivation are not allowed.protected voidsetParent(Structure parent)Sets the parent for this SimpleTypevoidsetRedefined()Sets this Group has redefined.(package private) voidsetTypeCode(int code)Package private setter of the code for this simple type.voidvalidate()Checks the validity of this SimpleType definition.-
Methods inherited from class org.exolab.castor.xml.schema.XMLType
getBaseType, getBaseTypeName, getDerivationMethod, getId, getName, getSchema, getType, isAnyType, isComplexType, isSimpleType, setBaseType, setDerivationMethod, setId, setName, setSchema
-
Methods inherited from class org.exolab.castor.xml.schema.Annotated
addAnnotation, getAnnotations, removeAnnotation
-
-
-
-
Field Detail
-
FINAL_ALL
public static final java.lang.String FINAL_ALL
The value of the final attribute used for blocking all types of derivation.- See Also:
- Constant Field Values
-
FINAL_LIST
public static final java.lang.String FINAL_LIST
The value of the final attribute used for blocking list derivation.- See Also:
- Constant Field Values
-
FINAL_UNION
public static final java.lang.String FINAL_UNION
The value of the final attribute used for blocking union derivation.- See Also:
- Constant Field Values
-
FINAL_RESTRICTION
public static final java.lang.String FINAL_RESTRICTION
The value of the final attribute used for blocking restriction derivation.- See Also:
- Constant Field Values
-
-
Method Detail
-
addFacet
public void addFacet(Facet facet)
Adds the given Facet to this Simpletype.- Parameters:
facet- the Facet to add to this Simpletype
-
getFacet
public Facet getFacet(java.lang.String name)
Returns the first facet associated with the given name.- Parameters:
name- the name of the Facet to look for- Returns:
- the first facet associated with the given name
-
getFacets
public java.util.Enumeration<Facet> getFacets(java.lang.String name)
Returns the facets associated with the given name.- Parameters:
name- the name of the Facet to look for- Returns:
- the facets associated with the given name
-
getFacets
public java.util.Enumeration<Facet> getFacets()
Returns an Enumeration of all the Facets (including inherited) facets for this type.- Returns:
- an Enumeration of all the Facets for this type
-
getFinal
public java.lang.String getFinal()
Returns the value of the 'final' property, indicating which types of derivation are not allowed, or null if the final property has not been set.- Returns:
- the value of the final property or null if no value has been set
-
getLocalFacets
public java.util.Enumeration<Facet> getLocalFacets()
Returns the facets of this type (without the parent's facets).- Returns:
- the local facets of this type.
-
getEffectiveFacets
public java.util.Enumeration<Facet> getEffectiveFacets()
Returns an enumeration of the effective facets for this type. A set of effective facets contains all local facets and only those inherited facets that are not overridden by the local facets.- Returns:
- an enumeration of the effective facets for this type.
- See Also:
getLocalFacets(),getFacets()
-
getBuiltInBaseType
public SimpleType getBuiltInBaseType()
Returns the built in type this type is derived from.
-
getParent
public Structure getParent()
Returns the parent Structure that contains this SimpleType. This can be either a Schema, AttributeDecl or ElementDecl.- Returns:
- the parent of this SimpleType
-
getReferenceId
public java.lang.String getReferenceId()
Returns the Id used to Refer to this Object.- Specified by:
getReferenceIdin interfaceReferable- Returns:
- the Id used to Refer to this Object
- See Also:
Referable
-
hasFacet
public boolean hasFacet(java.lang.String name)
Returns true if thisSimpleTypehas a specifiedFacetwith the given name.- Parameters:
name- the name of theFacetto look for- Returns:
- true if this
SimpleTypehas a specifiedFacetwith the given name
-
isBuiltInType
public boolean isBuiltInType()
Returns true if this SimpleType is a built in type.- Returns:
- true if this SimpleType is a built in type
-
isNumericType
public boolean isNumericType()
Indicates whether thisSimpleTypeis a numeric type.- Returns:
- True if this SimpleType is a numeric type
-
isDateTimeType
public boolean isDateTimeType()
Indicates whether thisSimpleTypeis a date/time type.- Returns:
- True if this SimpleType is a date/time type
-
isRedefined
public boolean isRedefined()
Returns true if this simpleType is a redefinition.- Returns:
- true if this simpleType is a redefinition.
-
setRedefined
public void setRedefined()
Sets this Group has redefined.
-
getTypeCode
public int getTypeCode()
Gets the code for this simple type. (as defined in SimpleTypesFactory)- Returns:
- the type code for this simple type
-
setTypeCode
void setTypeCode(int code)
Package private setter of the code for this simple type.
-
getLength
public java.lang.Long getLength()
Returns the value of the length facet result can be null
-
getMinLength
public java.lang.Long getMinLength()
Returns the value of the minlength facet result can be null
-
getMaxLength
public java.lang.Long getMaxLength()
Returns the value of the maxlength facet result can be null
-
removeFacet
public boolean removeFacet(Facet facet)
Removes the given Facet from this SimpleType. Returns true if this SimpleType actually contains the given facet.Removes only local facets.
- Parameters:
facet- the Facet to remove- Returns:
- true if the specified Facet has been removed
-
removeFacet
public boolean removeFacet(java.lang.String name)
Removes the facet with the given name from this SimpleType. Returns true if this Simpletype has a facet with the given name and it is successfully removed.Removes only local facets.
- Parameters:
name- the name of the Facet to remove- Returns:
- true if the specified Facet has been removed
-
setFinal
public void setFinal(java.lang.String finalValue)
Sets the value of the 'final' property, indicating which types of derivation are not allowed. A null value will indicate all types of derivation (list, restriction, union) are allowed.- Parameters:
finalValue- the value of the final property.- Throws:
java.lang.IllegalArgumentException- when the value is not a valid value.
-
getStructureType
public short getStructureType()
Returns the type of this Schema Structure- Specified by:
getStructureTypein classStructure- Returns:
- the type of this Schema Structure
-
validate
public void validate() throws ValidationExceptionChecks the validity of this SimpleType definition.- Specified by:
validatein classStructure- Throws:
ValidationException- when this SimpleType definition is invalid.
-
createReference
protected SimpleType createReference(java.lang.String name)
A helper method for classes which extend SimpleType. This method allows creating a reference to a SimpleType.- Returns:
- the reference to the SimpleType.
-
resolveReference
protected static SimpleType resolveReference(SimpleType simpleType)
A helper method for classes which extend SimpleType. This method allows resolving a SimpleType reference to a SimpleType.- Returns:
- the resolved SimpleType.
- See Also:
createReference(java.lang.String)
-
setParent
protected void setParent(Structure parent)
Sets the parent for this SimpleType
-
copyFacets
protected void copyFacets(SimpleType target)
Copy this type's facets to the target type.- Parameters:
target- the SimpleType to copy facets to
-
getNumberOfFacets
public int getNumberOfFacets(java.lang.String name)
Returns the number of facets named 'name' within the list of facets of this simple type.- Parameters:
name- Name (type) of the facet.- Returns:
- number of facets named 'name'
-
-