Package org.exolab.castor.xml.schema
Class SimpleTypesFactory
- java.lang.Object
-
- org.exolab.castor.xml.schema.SimpleTypesFactory
-
public class SimpleTypesFactory extends java.lang.Object
SimpleTypesFactory provides code constants for every built in type defined in www.w3.org/TR/xmlschma-2-20000407 USER_TYPE is used for user derived types. This factory can also create instances of classes derived from SimpleType that represent the simple types defined by xmlschema and those derived from them.- Version:
- $Revision: 8145 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
- Author:
- Arnaud Berry
-
-
Field Summary
Fields Modifier and Type Field Description static int
ANYSIMPLETYPE_TYPE
static int
ANYURI_TYPE
static int
BASE64BINARY_TYPE
static int
BOOLEAN_TYPE
static int
BYTE_TYPE
static int
DATE_TYPE
static int
DATETIME_TYPE
static int
DECIMAL_TYPE
static int
DOUBLE_TYPE
static int
DURATION_TYPE
static int
ENTITIES_TYPE
static int
ENTITY_TYPE
static int
FLOAT_TYPE
static int
GDAY_TYPE
static int
GMONTH_TYPE
static int
GMONTHDAY_TYPE
static int
GYEAR_TYPE
static int
GYEARMONTH_TYPE
static int
HEXBINARY_TYPE
static int
ID_TYPE
static int
IDREF_TYPE
static int
IDREFS_TYPE
static int
INT_TYPE
static int
INTEGER_TYPE
static int
INVALID_TYPE
This code is for errors or uninitialized types.static int
LANGUAGE_TYPE
static int
LONG_TYPE
static int
NAME_TYPE
static int
NCNAME_TYPE
static int
NEGATIVE_INTEGER_TYPE
static int
NMTOKEN_TYPE
static int
NMTOKENS_TYPE
static int
NON_NEGATIVE_INTEGER_TYPE
static int
NON_POSITIVE_INTEGER_TYPE
static int
NORMALIZEDSTRING_TYPE
static int
NOTATION_TYPE
static int
POSITIVE_INTEGER_TYPE
static int
QNAME_TYPE
(package private) static java.lang.String
RESOURCE_LOCATION
The resource location for the built-in types property files.static int
SHORT_TYPE
static int
STRING_TYPE
static int
TIME_TYPE
static int
TOKEN_TYPE
(package private) static java.lang.String
TYPE_DEFINITIONS
The resource for the Simple types.(package private) static java.lang.String
TYPE_MAPPINGS
The resource for the mapping properties.static int
UNSIGNED_BYTE_TYPE
static int
UNSIGNED_INT_TYPE
static int
UNSIGNED_LONG_TYPE
static int
UNSIGNED_SHORT_TYPE
static int
USER_TYPE
Simple type defined by the user.
-
Constructor Summary
Constructors Constructor Description SimpleTypesFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) SimpleType
createUserSimpleType(Schema schema, java.lang.String name, java.lang.String baseName, java.lang.String derivation, boolean createDeferredSimpleType)
Creates an instance of a class derived from SimpleType, representing the user type defined by the given name, baseName and derivation method.(package private) SimpleType
createUserSimpleType(Schema schema, java.lang.String name, SimpleType baseType, java.lang.String derivation)
Creates an instance of a class derived from SimpleType, representing the user type defined by the given name, baseName and derivation method.SimpleType
getBuiltInType(java.lang.String typeName)
Gets an instance of a class derived fromSimpleType
representing the built in type which name is given as a parameter.java.lang.String
getBuiltInTypeName(int builtInTypeCode)
Gets a built in type's name given its code.static boolean
isBuiltInType(int codeType)
Indicates if a type code corresponds to an xml schema built in type.static boolean
isDateTimeType(int codeType)
Tells if a type code corresponds to an xml schema (built-in) date/time type.static boolean
isNumericType(int codeType)
Tells if a type code corresponds to an xml schema (built-in) numeric type.static boolean
isPrimitiveType(int codeType)
Tells if a type code corresponds to an xml schema (built-in) primitive type.
-
-
-
Field Detail
-
INVALID_TYPE
public static final int INVALID_TYPE
This code is for errors or uninitialized types.- See Also:
- Constant Field Values
-
USER_TYPE
public static final int USER_TYPE
Simple type defined by the user.- See Also:
- Constant Field Values
-
STRING_TYPE
public static final int STRING_TYPE
- See Also:
- Constant Field Values
-
DURATION_TYPE
public static final int DURATION_TYPE
- See Also:
- Constant Field Values
-
DATETIME_TYPE
public static final int DATETIME_TYPE
- See Also:
- Constant Field Values
-
TIME_TYPE
public static final int TIME_TYPE
- See Also:
- Constant Field Values
-
DATE_TYPE
public static final int DATE_TYPE
- See Also:
- Constant Field Values
-
GYEARMONTH_TYPE
public static final int GYEARMONTH_TYPE
- See Also:
- Constant Field Values
-
GYEAR_TYPE
public static final int GYEAR_TYPE
- See Also:
- Constant Field Values
-
GMONTHDAY_TYPE
public static final int GMONTHDAY_TYPE
- See Also:
- Constant Field Values
-
GDAY_TYPE
public static final int GDAY_TYPE
- See Also:
- Constant Field Values
-
GMONTH_TYPE
public static final int GMONTH_TYPE
- See Also:
- Constant Field Values
-
BOOLEAN_TYPE
public static final int BOOLEAN_TYPE
- See Also:
- Constant Field Values
-
BASE64BINARY_TYPE
public static final int BASE64BINARY_TYPE
- See Also:
- Constant Field Values
-
HEXBINARY_TYPE
public static final int HEXBINARY_TYPE
- See Also:
- Constant Field Values
-
FLOAT_TYPE
public static final int FLOAT_TYPE
- See Also:
- Constant Field Values
-
DOUBLE_TYPE
public static final int DOUBLE_TYPE
- See Also:
- Constant Field Values
-
DECIMAL_TYPE
public static final int DECIMAL_TYPE
- See Also:
- Constant Field Values
-
ANYURI_TYPE
public static final int ANYURI_TYPE
- See Also:
- Constant Field Values
-
QNAME_TYPE
public static final int QNAME_TYPE
- See Also:
- Constant Field Values
-
NOTATION_TYPE
public static final int NOTATION_TYPE
- See Also:
- Constant Field Values
-
NORMALIZEDSTRING_TYPE
public static final int NORMALIZEDSTRING_TYPE
- See Also:
- Constant Field Values
-
TOKEN_TYPE
public static final int TOKEN_TYPE
- See Also:
- Constant Field Values
-
LANGUAGE_TYPE
public static final int LANGUAGE_TYPE
- See Also:
- Constant Field Values
-
NAME_TYPE
public static final int NAME_TYPE
- See Also:
- Constant Field Values
-
NCNAME_TYPE
public static final int NCNAME_TYPE
- See Also:
- Constant Field Values
-
ID_TYPE
public static final int ID_TYPE
- See Also:
- Constant Field Values
-
IDREF_TYPE
public static final int IDREF_TYPE
- See Also:
- Constant Field Values
-
IDREFS_TYPE
public static final int IDREFS_TYPE
- See Also:
- Constant Field Values
-
ENTITY_TYPE
public static final int ENTITY_TYPE
- See Also:
- Constant Field Values
-
ENTITIES_TYPE
public static final int ENTITIES_TYPE
- See Also:
- Constant Field Values
-
NMTOKEN_TYPE
public static final int NMTOKEN_TYPE
- See Also:
- Constant Field Values
-
NMTOKENS_TYPE
public static final int NMTOKENS_TYPE
- See Also:
- Constant Field Values
-
INTEGER_TYPE
public static final int INTEGER_TYPE
- See Also:
- Constant Field Values
-
NON_POSITIVE_INTEGER_TYPE
public static final int NON_POSITIVE_INTEGER_TYPE
- See Also:
- Constant Field Values
-
NEGATIVE_INTEGER_TYPE
public static final int NEGATIVE_INTEGER_TYPE
- See Also:
- Constant Field Values
-
LONG_TYPE
public static final int LONG_TYPE
- See Also:
- Constant Field Values
-
INT_TYPE
public static final int INT_TYPE
- See Also:
- Constant Field Values
-
SHORT_TYPE
public static final int SHORT_TYPE
- See Also:
- Constant Field Values
-
BYTE_TYPE
public static final int BYTE_TYPE
- See Also:
- Constant Field Values
-
NON_NEGATIVE_INTEGER_TYPE
public static final int NON_NEGATIVE_INTEGER_TYPE
- See Also:
- Constant Field Values
-
UNSIGNED_LONG_TYPE
public static final int UNSIGNED_LONG_TYPE
- See Also:
- Constant Field Values
-
UNSIGNED_INT_TYPE
public static final int UNSIGNED_INT_TYPE
- See Also:
- Constant Field Values
-
UNSIGNED_SHORT_TYPE
public static final int UNSIGNED_SHORT_TYPE
- See Also:
- Constant Field Values
-
UNSIGNED_BYTE_TYPE
public static final int UNSIGNED_BYTE_TYPE
- See Also:
- Constant Field Values
-
POSITIVE_INTEGER_TYPE
public static final int POSITIVE_INTEGER_TYPE
- See Also:
- Constant Field Values
-
ANYSIMPLETYPE_TYPE
public static final int ANYSIMPLETYPE_TYPE
- See Also:
- Constant Field Values
-
RESOURCE_LOCATION
static final java.lang.String RESOURCE_LOCATION
The resource location for the built-in types property files.- See Also:
- Constant Field Values
-
TYPE_MAPPINGS
static final java.lang.String TYPE_MAPPINGS
The resource for the mapping properties.- See Also:
- Constant Field Values
-
TYPE_DEFINITIONS
static final java.lang.String TYPE_DEFINITIONS
The resource for the Simple types.- See Also:
- Constant Field Values
-
-
Method Detail
-
isBuiltInType
public static boolean isBuiltInType(int codeType)
Indicates if a type code corresponds to an xml schema built in type.- Parameters:
codeType
- The type code to check.- Returns:
- True if the given type code represents an XML schema built-in type.
-
isPrimitiveType
public static boolean isPrimitiveType(int codeType)
Tells if a type code corresponds to an xml schema (built-in) primitive type.- Parameters:
codeType
- The type code to check.- Returns:
- True if the given type code represents an XML schema built-in primitive type.
-
isNumericType
public static boolean isNumericType(int codeType)
Tells if a type code corresponds to an xml schema (built-in) numeric type.- Parameters:
codeType
- The type code to check.- Returns:
- True if the given type code represents an XML schema built-in numeric type.
-
isDateTimeType
public static boolean isDateTimeType(int codeType)
Tells if a type code corresponds to an xml schema (built-in) date/time type.- Parameters:
codeType
- The type code to check.- Returns:
- True if the given type code represents an XML schema built-in date/time type.
-
getBuiltInType
public SimpleType getBuiltInType(java.lang.String typeName)
Gets an instance of a class derived fromSimpleType
representing the built in type which name is given as a parameter.- Parameters:
typeName
- Name of the simple type.- Returns:
- The
SimpleType
instance for the type name.
-
getBuiltInTypeName
public java.lang.String getBuiltInTypeName(int builtInTypeCode)
Gets a built in type's name given its code.
-
createUserSimpleType
SimpleType createUserSimpleType(Schema schema, java.lang.String name, java.lang.String baseName, java.lang.String derivation, boolean createDeferredSimpleType)
Creates an instance of a class derived from SimpleType, representing the user type defined by the given name, baseName and derivation method. Package private (used by Schema and DeferredSimpleType). The given schema is used as the owning Schema document, yet a call to schema.addSimpleType must till be made to add the SimpleType to the Schema. If the base type is not found in the schema, a DeferredSimpleType will be returned if createDeferredSimpleType is true, null otherwise.- Parameters:
schema
- the owning schemaname
- the name of the SimpleTypebaseName
- the name of the SimpleType's base typederivation
- the name of the derivation method (null/""/"list"/"restriction")createDeferredSimpleType
- should the type be deferred if it can't be created.- Returns:
- the new SimpleType, or null if its parent could not be found.
-
createUserSimpleType
SimpleType createUserSimpleType(Schema schema, java.lang.String name, SimpleType baseType, java.lang.String derivation)
Creates an instance of a class derived from SimpleType, representing the user type defined by the given name, baseName and derivation method. Package private (used by Schema and DeferredSimpleType). The given schema is used as the owning Schema document, yet a call to schema#addSimpleType must still be made to add the SimpleType to the Schema if the SimpleType is not anonymous. If the base type is not found in the schema, a DeferredSimpleType will be returned if createDeferredSimpleType is true, null otherwise.- Parameters:
schema
- the owning schemaname
- the name of the SimpleTypebaseType
- the base typederivation
- the name of the derivation method (null/""/"list"/"restriction")- Returns:
- the new SimpleType, or null if its parent could not be found.
-
-