Package org.exolab.castor.builder.types
Class XSType
java.lang.Object
org.exolab.castor.builder.types.XSType
- Direct Known Subclasses:
AbstractPatternFacet
,XSClass
,XSListType
The base XML Schema Type class.
- Version:
- $Revision$ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
- Author:
- Keith Visco, Ralf Joachim
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final short
xsd:anyURI.static final short
xsd:base64Binary.static final short
xsd:boolean.static final short
xsd:byte.static final short
A user-defined type.static final short
A collection type.static final short
xsd:date.static final short
xsd:dateTime.static final short
xsd:decimal.static final short
xsd:double.static final short
xsd:duration.static final short
xsd:ENTITIES.static final short
xsd:ENTITY.static final short
xsd:float.static final short
xsd:gDay.static final short
xsd:gMonth.static final short
xsd:gMonthDay.static final short
xsd:gYear.static final short
xsd:gYearMonth.static final short
xsd:hexBinary.static final short
xsd:ID.static final short
xsd:IDREF.static final short
xsd:IDREFS.static final short
xsd:int.static final short
xsd:integer.static final short
xsd:language.static final short
xsd:long.static final short
xsd:name.static final short
xsd:NCNAME.static final short
xsd:negativeInteger.static final short
xsd:NMTOKEN.static final short
xsd:NMTOKENS.static final short
xsd:nonNegativeInteger.static final short
xsd:nonPositiveInteger.static final short
xsd:normalizedString.static final short
xsd:notation.static final short
Value meaning the type is unassigned.static final short
xsd:positiveInteger.static final short
xsd:QName.static final short
xsd:short.static final short
xsd:string.static final short
xsd:time.static final short
xsd:token.static final short
xsd:unsignedByte.static final short
xsd:unsignedInt.static final short
xsd:unsignedLong.static final short
xsd:unsignedShort. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDefaultValueWithString
(String variableName) Creates source code for an additional constructor that deals with default values as specified in the XML schema instance.abstract String
createFromJavaObjectCode
(String variableName) Returns the string necessary to convert an Object to an instance of this XSType.abstract String
createToJavaObjectCode
(String variableName) Returns the string necessary to convert an instance of this XSType to an Object.abstract JType
getJType()
Returns the JType that this XSType represents.abstract String
getName()
Returns the name of this XSType.abstract short
getType()
Returns the type of this XSType.boolean
Returns true if this XSType represents a collection.abstract boolean
Returns true if the XSType represents an XML Schema date/time type.final boolean
Returns true if this XSType represents an enumerated type.abstract boolean
Returns true if this XSType represents a primitive type.abstract String
Returns the Java code neccessary to create a new instance of the JType associated with this XSType.final void
setAsEnumerated
(boolean enumerated) Sets the enumerated flag for this XSClass.protected abstract void
Set the given facet for XSType if applicable.final void
setFacets
(SimpleType simpleType) Reads and sets the facets for XSType.abstract void
validationCode
(JSourceCode jsc, String fixedValue, String validatorInstanceName) Creates the validation code for an instance of this XSType.
-
Field Details
-
NULL
public static final short NULLValue meaning the type is unassigned.- See Also:
-
CLASS
public static final short CLASSA user-defined type.- See Also:
-
STRING_TYPE
public static final short STRING_TYPExsd:string.- See Also:
-
DURATION_TYPE
public static final short DURATION_TYPExsd:duration.- See Also:
-
DATETIME_TYPE
public static final short DATETIME_TYPExsd:dateTime.- See Also:
-
TIME_TYPE
public static final short TIME_TYPExsd:time.- See Also:
-
DATE_TYPE
public static final short DATE_TYPExsd:date.- See Also:
-
GYEARMONTH_TYPE
public static final short GYEARMONTH_TYPExsd:gYearMonth.- See Also:
-
GYEAR_TYPE
public static final short GYEAR_TYPExsd:gYear.- See Also:
-
GMONTHDAY_TYPE
public static final short GMONTHDAY_TYPExsd:gMonthDay.- See Also:
-
GDAY_TYPE
public static final short GDAY_TYPExsd:gDay.- See Also:
-
GMONTH_TYPE
public static final short GMONTH_TYPExsd:gMonth.- See Also:
-
BOOLEAN_TYPE
public static final short BOOLEAN_TYPExsd:boolean.- See Also:
-
BASE64BINARY_TYPE
public static final short BASE64BINARY_TYPExsd:base64Binary.- See Also:
-
HEXBINARY_TYPE
public static final short HEXBINARY_TYPExsd:hexBinary.- See Also:
-
FLOAT_TYPE
public static final short FLOAT_TYPExsd:float.- See Also:
-
DOUBLE_TYPE
public static final short DOUBLE_TYPExsd:double.- See Also:
-
DECIMAL_TYPE
public static final short DECIMAL_TYPExsd:decimal.- See Also:
-
ANYURI_TYPE
public static final short ANYURI_TYPExsd:anyURI.- See Also:
-
QNAME_TYPE
public static final short QNAME_TYPExsd:QName.- See Also:
-
NOTATION_TYPE
public static final short NOTATION_TYPExsd:notation.- See Also:
-
NORMALIZEDSTRING_TYPE
public static final short NORMALIZEDSTRING_TYPExsd:normalizedString.- See Also:
-
TOKEN_TYPE
public static final short TOKEN_TYPExsd:token.- See Also:
-
LANGUAGE_TYPE
public static final short LANGUAGE_TYPExsd:language.- See Also:
-
NAME_TYPE
public static final short NAME_TYPExsd:name.- See Also:
-
NCNAME_TYPE
public static final short NCNAME_TYPExsd:NCNAME.- See Also:
-
ID_TYPE
public static final short ID_TYPExsd:ID.- See Also:
-
IDREF_TYPE
public static final short IDREF_TYPExsd:IDREF.- See Also:
-
IDREFS_TYPE
public static final short IDREFS_TYPExsd:IDREFS.- See Also:
-
ENTITY
public static final short ENTITYxsd:ENTITY.- See Also:
-
ENTITIES
public static final short ENTITIESxsd:ENTITIES.- See Also:
-
NMTOKEN_TYPE
public static final short NMTOKEN_TYPExsd:NMTOKEN.- See Also:
-
NMTOKENS_TYPE
public static final short NMTOKENS_TYPExsd:NMTOKENS.- See Also:
-
INTEGER_TYPE
public static final short INTEGER_TYPExsd:integer.- See Also:
-
NON_POSITIVE_INTEGER_TYPE
public static final short NON_POSITIVE_INTEGER_TYPExsd:nonPositiveInteger.- See Also:
-
NEGATIVE_INTEGER_TYPE
public static final short NEGATIVE_INTEGER_TYPExsd:negativeInteger.- See Also:
-
LONG_TYPE
public static final short LONG_TYPExsd:long.- See Also:
-
INT_TYPE
public static final short INT_TYPExsd:int.- See Also:
-
SHORT_TYPE
public static final short SHORT_TYPExsd:short.- See Also:
-
BYTE_TYPE
public static final short BYTE_TYPExsd:byte.- See Also:
-
NON_NEGATIVE_INTEGER_TYPE
public static final short NON_NEGATIVE_INTEGER_TYPExsd:nonNegativeInteger.- See Also:
-
POSITIVE_INTEGER_TYPE
public static final short POSITIVE_INTEGER_TYPExsd:positiveInteger.- See Also:
-
COLLECTION
public static final short COLLECTIONA collection type.- See Also:
-
UNSIGNED_LONG_TYPE
public static final short UNSIGNED_LONG_TYPExsd:unsignedLong.- See Also:
-
UNSIGNED_SHORT_TYPE
public static final short UNSIGNED_SHORT_TYPExsd:unsignedShort.- See Also:
-
UNSIGNED_BYTE_TYPE
public static final short UNSIGNED_BYTE_TYPExsd:unsignedByte.- See Also:
-
UNSIGNED_INT_TYPE
public static final short UNSIGNED_INT_TYPExsd:unsignedInt.- See Also:
-
-
Constructor Details
-
XSType
public XSType()
-
-
Method Details
-
isEnumerated
public final boolean isEnumerated()Returns true if this XSType represents an enumerated type.- Returns:
- True if this XSType represents an enumerated type.
-
setAsEnumerated
public final void setAsEnumerated(boolean enumerated) Sets the enumerated flag for this XSClass.- Parameters:
enumerated
- A boolean indicating whether or not this XSClass represents an enumerated type.
-
getName
-
getType
public abstract short getType()Returns the type of this XSType.- Returns:
- the type of this XSType.
-
isPrimitive
public abstract boolean isPrimitive()Returns true if this XSType represents a primitive type.- Returns:
- True if this XSType represents a primitive type.
-
isDateTime
public abstract boolean isDateTime()Returns true if the XSType represents an XML Schema date/time type.- Returns:
- True if the XSType represents an XML Schema date/time type.
-
isCollection
public boolean isCollection()Returns true if this XSType represents a collection.- Returns:
- True if this XSType represents a collection.
-
getJType
Returns the JType that this XSType represents.- Returns:
- The JType that this XSType represents.
-
newInstanceCode
Returns the Java code neccessary to create a new instance of the JType associated with this XSType.- Returns:
- The Java code neccessary to create a new instance.
-
createToJavaObjectCode
Returns the string necessary to convert an instance of this XSType to an Object. This method is really only useful for primitive types.- Parameters:
variableName
- The name of the instance variable.- Returns:
- The String necessary to convert an instance of this XSType to an Object.
-
createFromJavaObjectCode
Returns the string necessary to convert an Object to an instance of this XSType. This method is really only useful for primitive types.- Parameters:
variableName
- The name of the Object.- Returns:
- The String necessary to convert an Object to an instance of this XSType.
-
createDefaultValueWithString
Creates source code for an additional constructor that deals with default values as specified in the XML schema instance.- Parameters:
variableName
- Name of the constructor argument.- Returns:
- Source code for dealing with default values.
-
setFacets
Reads and sets the facets for XSType.- Parameters:
simpleType
- The SimpleType containing the facets.
-
setFacet
Set the given facet for XSType if applicable.- Parameters:
facet
- The facet to set for XSType.
-
validationCode
public abstract void validationCode(JSourceCode jsc, String fixedValue, String validatorInstanceName) Creates the validation code for an instance of this XSType. If necessary the validation code should create a newly configured TypeValidator, that should then be added to a FieldValidator instance whose name is provided.- Parameters:
jsc
- The JSourceCode to fill in.fixedValue
- A fixed value to use if any.validatorInstanceName
- The name of the FieldValidator that the configured TypeValidator should be added to.
-