org.exolab.castor.builder.types
Class XSType

java.lang.Object
  extended by org.exolab.castor.builder.types.XSType
Direct Known Subclasses:
AbstractPatternFacet, XSClass, XSListType

public abstract class XSType
extends java.lang.Object

The base XML Schema Type class.

Version:
$Revision: 7943 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
Author:
Keith Visco, Ralf Joachim

Field Summary
static short ANYURI_TYPE
          xsd:anyURI.
static short BASE64BINARY_TYPE
          xsd:base64Binary.
static short BOOLEAN_TYPE
          xsd:boolean.
static short BYTE_TYPE
          xsd:byte.
static short CLASS
          A user-defined type.
static short COLLECTION
          A collection type.
static short DATE_TYPE
          xsd:date.
static short DATETIME_TYPE
          xsd:dateTime.
static short DECIMAL_TYPE
          xsd:decimal.
static short DOUBLE_TYPE
          xsd:double.
static short DURATION_TYPE
          xsd:duration.
static short ENTITIES
          xsd:ENTITIES.
static short ENTITY
          xsd:ENTITY.
static short FLOAT_TYPE
          xsd:float.
static short GDAY_TYPE
          xsd:gDay.
static short GMONTH_TYPE
          xsd:gMonth.
static short GMONTHDAY_TYPE
          xsd:gMonthDay.
static short GYEAR_TYPE
          xsd:gYear.
static short GYEARMONTH_TYPE
          xsd:gYearMonth.
static short HEXBINARY_TYPE
          xsd:hexBinary.
static short ID_TYPE
          xsd:ID.
static short IDREF_TYPE
          xsd:IDREF.
static short IDREFS_TYPE
          xsd:IDREFS.
static short INT_TYPE
          xsd:int.
static short INTEGER_TYPE
          xsd:integer.
static short LANGUAGE_TYPE
          xsd:language.
static short LONG_TYPE
          xsd:long.
static short NAME_TYPE
          xsd:name.
static short NCNAME_TYPE
          xsd:NCNAME.
static short NEGATIVE_INTEGER_TYPE
          xsd:negativeInteger.
static short NMTOKEN_TYPE
          xsd:NMTOKEN.
static short NMTOKENS_TYPE
          xsd:NMTOKENS.
static short NON_NEGATIVE_INTEGER_TYPE
          xsd:nonNegativeInteger.
static short NON_POSITIVE_INTEGER_TYPE
          xsd:nonPositiveInteger.
static short NORMALIZEDSTRING_TYPE
          xsd:normalizedString.
static short NOTATION_TYPE
          xsd:notation.
static short NULL
          Value meaning the type is unassigned.
static short POSITIVE_INTEGER_TYPE
          xsd:positiveInteger.
static short QNAME_TYPE
          xsd:QName.
static short SHORT_TYPE
          xsd:short.
static short STRING_TYPE
          xsd:string.
static short TIME_TYPE
          xsd:time.
static short TOKEN_TYPE
          xsd:token.
static short UNSIGNED_BYTE_TYPE
          xsd:unsignedByte.
static short UNSIGNED_INT_TYPE
          xsd:unsignedInt.
static short UNSIGNED_LONG_TYPE
          xsd:unsignedLong.
static short UNSIGNED_SHORT_TYPE
          xsd:unsignedShort.
 
Constructor Summary
XSType()
           
 
Method Summary
 java.lang.String createDefaultValueWithString(java.lang.String variableName)
          Creates source code for an additional constructor that deals with default values as specified in the XML schema instance.
abstract  java.lang.String createFromJavaObjectCode(java.lang.String variableName)
          Returns the string necessary to convert an Object to an instance of this XSType.
abstract  java.lang.String createToJavaObjectCode(java.lang.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  java.lang.String getName()
          Returns the name of this XSType.
abstract  short getType()
          Returns the type of this XSType.
 boolean isCollection()
          Returns true if this XSType represents a collection.
abstract  boolean isDateTime()
          Returns true if the XSType represents an XML Schema date/time type.
 boolean isEnumerated()
          Returns true if this XSType represents an enumerated type.
abstract  boolean isPrimitive()
          Returns true if this XSType represents a primitive type.
abstract  java.lang.String newInstanceCode()
          Returns the Java code neccessary to create a new instance of the JType associated with this XSType.
 void setAsEnumerated(boolean enumerated)
          Sets the enumerated flag for this XSClass.
protected abstract  void setFacet(Facet facet)
          Set the given facet for XSType if applicable.
 void setFacets(SimpleType simpleType)
          Reads and sets the facets for XSType.
abstract  void validationCode(JSourceCode jsc, java.lang.String fixedValue, java.lang.String validatorInstanceName)
          Creates the validation code for an instance of this XSType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final short NULL
Value meaning the type is unassigned.

See Also:
Constant Field Values

CLASS

public static final short CLASS
A user-defined type.

See Also:
Constant Field Values

STRING_TYPE

public static final short STRING_TYPE
xsd:string.

See Also:
Constant Field Values

DURATION_TYPE

public static final short DURATION_TYPE
xsd:duration.

See Also:
Constant Field Values

DATETIME_TYPE

public static final short DATETIME_TYPE
xsd:dateTime.

See Also:
Constant Field Values

TIME_TYPE

public static final short TIME_TYPE
xsd:time.

See Also:
Constant Field Values

DATE_TYPE

public static final short DATE_TYPE
xsd:date.

See Also:
Constant Field Values

GYEARMONTH_TYPE

public static final short GYEARMONTH_TYPE
xsd:gYearMonth.

See Also:
Constant Field Values

GYEAR_TYPE

public static final short GYEAR_TYPE
xsd:gYear.

See Also:
Constant Field Values

GMONTHDAY_TYPE

public static final short GMONTHDAY_TYPE
xsd:gMonthDay.

See Also:
Constant Field Values

GDAY_TYPE

public static final short GDAY_TYPE
xsd:gDay.

See Also:
Constant Field Values

GMONTH_TYPE

public static final short GMONTH_TYPE
xsd:gMonth.

See Also:
Constant Field Values

BOOLEAN_TYPE

public static final short BOOLEAN_TYPE
xsd:boolean.

See Also:
Constant Field Values

BASE64BINARY_TYPE

public static final short BASE64BINARY_TYPE
xsd:base64Binary.

See Also:
Constant Field Values

HEXBINARY_TYPE

public static final short HEXBINARY_TYPE
xsd:hexBinary.

See Also:
Constant Field Values

FLOAT_TYPE

public static final short FLOAT_TYPE
xsd:float.

See Also:
Constant Field Values

DOUBLE_TYPE

public static final short DOUBLE_TYPE
xsd:double.

See Also:
Constant Field Values

DECIMAL_TYPE

public static final short DECIMAL_TYPE
xsd:decimal.

See Also:
Constant Field Values

ANYURI_TYPE

public static final short ANYURI_TYPE
xsd:anyURI.

See Also:
Constant Field Values

QNAME_TYPE

public static final short QNAME_TYPE
xsd:QName.

See Also:
Constant Field Values

NOTATION_TYPE

public static final short NOTATION_TYPE
xsd:notation.

See Also:
Constant Field Values

NORMALIZEDSTRING_TYPE

public static final short NORMALIZEDSTRING_TYPE
xsd:normalizedString.

See Also:
Constant Field Values

TOKEN_TYPE

public static final short TOKEN_TYPE
xsd:token.

See Also:
Constant Field Values

LANGUAGE_TYPE

public static final short LANGUAGE_TYPE
xsd:language.

See Also:
Constant Field Values

NAME_TYPE

public static final short NAME_TYPE
xsd:name.

See Also:
Constant Field Values

NCNAME_TYPE

public static final short NCNAME_TYPE
xsd:NCNAME.

See Also:
Constant Field Values

ID_TYPE

public static final short ID_TYPE
xsd:ID.

See Also:
Constant Field Values

IDREF_TYPE

public static final short IDREF_TYPE
xsd:IDREF.

See Also:
Constant Field Values

IDREFS_TYPE

public static final short IDREFS_TYPE
xsd:IDREFS.

See Also:
Constant Field Values

ENTITY

public static final short ENTITY
xsd:ENTITY.

See Also:
Constant Field Values

ENTITIES

public static final short ENTITIES
xsd:ENTITIES.

See Also:
Constant Field Values

NMTOKEN_TYPE

public static final short NMTOKEN_TYPE
xsd:NMTOKEN.

See Also:
Constant Field Values

NMTOKENS_TYPE

public static final short NMTOKENS_TYPE
xsd:NMTOKENS.

See Also:
Constant Field Values

INTEGER_TYPE

public static final short INTEGER_TYPE
xsd:integer.

See Also:
Constant Field Values

NON_POSITIVE_INTEGER_TYPE

public static final short NON_POSITIVE_INTEGER_TYPE
xsd:nonPositiveInteger.

See Also:
Constant Field Values

NEGATIVE_INTEGER_TYPE

public static final short NEGATIVE_INTEGER_TYPE
xsd:negativeInteger.

See Also:
Constant Field Values

LONG_TYPE

public static final short LONG_TYPE
xsd:long.

See Also:
Constant Field Values

INT_TYPE

public static final short INT_TYPE
xsd:int.

See Also:
Constant Field Values

SHORT_TYPE

public static final short SHORT_TYPE
xsd:short.

See Also:
Constant Field Values

BYTE_TYPE

public static final short BYTE_TYPE
xsd:byte.

See Also:
Constant Field Values

NON_NEGATIVE_INTEGER_TYPE

public static final short NON_NEGATIVE_INTEGER_TYPE
xsd:nonNegativeInteger.

See Also:
Constant Field Values

POSITIVE_INTEGER_TYPE

public static final short POSITIVE_INTEGER_TYPE
xsd:positiveInteger.

See Also:
Constant Field Values

COLLECTION

public static final short COLLECTION
A collection type.

See Also:
Constant Field Values

UNSIGNED_LONG_TYPE

public static final short UNSIGNED_LONG_TYPE
xsd:unsignedLong.

See Also:
Constant Field Values

UNSIGNED_SHORT_TYPE

public static final short UNSIGNED_SHORT_TYPE
xsd:unsignedShort.

See Also:
Constant Field Values

UNSIGNED_BYTE_TYPE

public static final short UNSIGNED_BYTE_TYPE
xsd:unsignedByte.

See Also:
Constant Field Values

UNSIGNED_INT_TYPE

public static final short UNSIGNED_INT_TYPE
xsd:unsignedInt.

See Also:
Constant Field Values
Constructor Detail

XSType

public XSType()
Method Detail

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

public abstract java.lang.String getName()
Returns the name of this XSType.

Returns:
The name of this XSType.

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

public abstract JType getJType()
Returns the JType that this XSType represents.

Returns:
The JType that this XSType represents.

newInstanceCode

public abstract java.lang.String 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

public abstract java.lang.String createToJavaObjectCode(java.lang.String variableName)
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

public abstract java.lang.String createFromJavaObjectCode(java.lang.String variableName)
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

public java.lang.String createDefaultValueWithString(java.lang.String variableName)
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

public final void setFacets(SimpleType simpleType)
Reads and sets the facets for XSType.

Parameters:
simpleType - The SimpleType containing the facets.

setFacet

protected abstract void setFacet(Facet facet)
Set the given facet for XSType if applicable.

Parameters:
facet - The facet to set for XSType.

validationCode

public abstract void validationCode(JSourceCode jsc,
                                    java.lang.String fixedValue,
                                    java.lang.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.


Copyright © 2011. All Rights Reserved.