org.exolab.castor.builder.types

Class XSType

Known Direct Subclasses:
AbstractPatternFacet, XSClass, XSListType

public abstract class XSType
extends java.lang.Object

The base XML Schema Type class.
Version:
$Revision: 7277 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
Authors:
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
DATETIME_TYPE
xsd:dateTime.
static short
DATE_TYPE
xsd:date.
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
GMONTHDAY_TYPE
xsd:gMonthDay.
static short
GMONTH_TYPE
xsd:gMonth.
static short
GYEARMONTH_TYPE
xsd:gYearMonth.
static short
GYEAR_TYPE
xsd:gYear.
static short
HEXBINARY_TYPE
xsd:hexBinary.
static short
IDREFS_TYPE
xsd:IDREFS.
static short
IDREF_TYPE
xsd:IDREF.
static short
ID_TYPE
xsd:ID.
static short
INTEGER_TYPE
xsd:integer.
static short
INT_TYPE
xsd:int.
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
NMTOKENS_TYPE
xsd:NMTOKENS.
static short
NMTOKEN_TYPE
xsd:NMTOKEN.
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.

Method Summary

String
createDefaultValueWithString(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
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 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, String fixedValue, String validatorInstanceName)
Creates the validation code for an instance of this XSType.

Field Details

ANYURI_TYPE

public static final short ANYURI_TYPE
xsd:anyURI.
Field Value:
17

BASE64BINARY_TYPE

public static final short BASE64BINARY_TYPE
xsd:base64Binary.
Field Value:
12

BOOLEAN_TYPE

public static final short BOOLEAN_TYPE
xsd:boolean.
Field Value:
11

BYTE_TYPE

public static final short BYTE_TYPE
xsd:byte.
Field Value:
38

CLASS

public static final short CLASS
A user-defined type.
Field Value:
0

COLLECTION

public static final short COLLECTION
A collection type.
Field Value:
45

DATETIME_TYPE

public static final short DATETIME_TYPE
xsd:dateTime.
Field Value:
3

DATE_TYPE

public static final short DATE_TYPE
xsd:date.
Field Value:
5

DECIMAL_TYPE

public static final short DECIMAL_TYPE
xsd:decimal.
Field Value:
16

DOUBLE_TYPE

public static final short DOUBLE_TYPE
xsd:double.
Field Value:
15

DURATION_TYPE

public static final short DURATION_TYPE
xsd:duration.
Field Value:
2

ENTITIES

public static final short ENTITIES
xsd:ENTITIES.
Field Value:
29

ENTITY

public static final short ENTITY
xsd:ENTITY.
Field Value:
28

FLOAT_TYPE

public static final short FLOAT_TYPE
xsd:float.
Field Value:
14

GDAY_TYPE

public static final short GDAY_TYPE
xsd:gDay.
Field Value:
9

GMONTHDAY_TYPE

public static final short GMONTHDAY_TYPE
xsd:gMonthDay.
Field Value:
8

GMONTH_TYPE

public static final short GMONTH_TYPE
xsd:gMonth.
Field Value:
10

GYEARMONTH_TYPE

public static final short GYEARMONTH_TYPE
xsd:gYearMonth.
Field Value:
6

GYEAR_TYPE

public static final short GYEAR_TYPE
xsd:gYear.
Field Value:
7

HEXBINARY_TYPE

public static final short HEXBINARY_TYPE
xsd:hexBinary.
Field Value:
13

IDREFS_TYPE

public static final short IDREFS_TYPE
xsd:IDREFS.
Field Value:
27

IDREF_TYPE

public static final short IDREF_TYPE
xsd:IDREF.
Field Value:
26

ID_TYPE

public static final short ID_TYPE
xsd:ID.
Field Value:
25

INTEGER_TYPE

public static final short INTEGER_TYPE
xsd:integer.
Field Value:
32

INT_TYPE

public static final short INT_TYPE
xsd:int.
Field Value:
36

LANGUAGE_TYPE

public static final short LANGUAGE_TYPE
xsd:language.
Field Value:
22

LONG_TYPE

public static final short LONG_TYPE
xsd:long.
Field Value:
35

NAME_TYPE

public static final short NAME_TYPE
xsd:name.
Field Value:
23

NCNAME_TYPE

public static final short NCNAME_TYPE
xsd:NCNAME.
Field Value:
24

NEGATIVE_INTEGER_TYPE

public static final short NEGATIVE_INTEGER_TYPE
xsd:negativeInteger.
Field Value:
34

NMTOKENS_TYPE

public static final short NMTOKENS_TYPE
xsd:NMTOKENS.
Field Value:
31

NMTOKEN_TYPE

public static final short NMTOKEN_TYPE
xsd:NMTOKEN.
Field Value:
30

NON_NEGATIVE_INTEGER_TYPE

public static final short NON_NEGATIVE_INTEGER_TYPE
xsd:nonNegativeInteger.
Field Value:
39

NON_POSITIVE_INTEGER_TYPE

public static final short NON_POSITIVE_INTEGER_TYPE
xsd:nonPositiveInteger.
Field Value:
33

NORMALIZEDSTRING_TYPE

public static final short NORMALIZEDSTRING_TYPE
xsd:normalizedString.
Field Value:
20

NOTATION_TYPE

public static final short NOTATION_TYPE
xsd:notation.
Field Value:
19

NULL

public static final short NULL
Value meaning the type is unassigned.
Field Value:
-1

POSITIVE_INTEGER_TYPE

public static final short POSITIVE_INTEGER_TYPE
xsd:positiveInteger.
Field Value:
44

QNAME_TYPE

public static final short QNAME_TYPE
xsd:QName.
Field Value:
18

SHORT_TYPE

public static final short SHORT_TYPE
xsd:short.
Field Value:
37

STRING_TYPE

public static final short STRING_TYPE
xsd:string.
Field Value:
1

TIME_TYPE

public static final short TIME_TYPE
xsd:time.
Field Value:
4

TOKEN_TYPE

public static final short TOKEN_TYPE
xsd:token.
Field Value:
21

UNSIGNED_BYTE_TYPE

public static final short UNSIGNED_BYTE_TYPE
xsd:unsignedByte.
Field Value:
48

UNSIGNED_INT_TYPE

public static final short UNSIGNED_INT_TYPE
xsd:unsignedInt.
Field Value:
49

UNSIGNED_LONG_TYPE

public static final short UNSIGNED_LONG_TYPE
xsd:unsignedLong.
Field Value:
46

UNSIGNED_SHORT_TYPE

public static final short UNSIGNED_SHORT_TYPE
xsd:unsignedShort.
Field Value:
47

Method Details

createDefaultValueWithString

public String createDefaultValueWithString(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.

createFromJavaObjectCode

public abstract String createFromJavaObjectCode(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.

createToJavaObjectCode

public abstract String createToJavaObjectCode(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.

getJType

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

getName

public abstract 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.

isCollection

public boolean isCollection()
Returns true if this XSType represents a collection.
Returns:
True if this XSType represents a collection.

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.

isEnumerated

public final boolean isEnumerated()
Returns true if this XSType represents an enumerated type.
Returns:
True if this XSType represents an enumerated type.

isPrimitive

public abstract boolean isPrimitive()
Returns true if this XSType represents a primitive type.
Returns:
True if this XSType represents a primitive type.

newInstanceCode

public abstract 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.

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.

setFacet

protected abstract void setFacet(Facet facet)
Set the given facet for XSType if applicable.
Parameters:
facet - The facet to set for XSType.

setFacets

public final void setFacets(SimpleType simpleType)
Reads and sets the facets for XSType.
Parameters:
simpleType - The SimpleType containing the facets.

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.

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com