Top Description Fields Constructors Methods
com.sun.msv.datatype.xsd

public Class DatatypeFactory

extends Object
Class Inheritance
Imports
org.relaxng.datatype.DatatypeException, java.util.Collection, .Iterator, .Map

Datatype object factory.

Applications should use this class to get and derive DataType objects. All methods are static.

Derivation by restriction should be done by using TypeIncubator.

Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private static final Map<K, V>
builtinType

a map that contains built in types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
add(Map<K, V> m, XSDatatypeImpl type)

private static XSDatatypeImpl
private static Map<K, V>
createInitialBuiltinTypesMap()

creates a map that contains frequently-used built-in types

public static XSDatatype

Returns:

always return non-null value. If error occurs, then an exception will be thrown.
deriveByList
(String
(URI,local) pair as the name of the new type. it can be set to null for an anonymous type.
nsUri
,
String newTypeName, XSDatatype
Type of the list item. It must be an atom type which is implemented in this package or derived from types implemented in this package. You cannot use your own DataType implementation here.
itemType
)

derives a new type by list.

public static XSDatatype
deriveByList(String newTypeName, XSDatatype itemType)

Deprecated
public static XSDatatype
deriveByUnion(String nsUri, String
name of the new type. it can be set to null to indicate an anonymous type.
newTypeName
,
XSDatatype[]
Types of the union member. It can be any type that implements DataType.
memberTypes
)

derives a new type by union.

public static XSDatatype
deriveByUnion(String newTypeName, XSDatatype[] memberTypes)

Deprecated
public static XSDatatype
deriveByUnion(String newTypeName, Collection<E> memberTypes)

Deprecated
public static XSDatatype
deriveByUnion(String nsUri, String newTypeName, Collection<E> memberTypes)

public static synchronized XSDatatype

Returns:

A non-null valid datatype object.
getTypeByName
(String dataTypeName)

obtain a built-in DataType object by its name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builtinTypeback to summary
private static final Map<K, V> builtinType

a map that contains built in types. To speed up the boot process, only a handful types are added at the first time.

Constructor Detail

DatatypeFactoryback to summary
private DatatypeFactory()

Method Detail

addback to summary
private static void add(Map<K, V> m, XSDatatypeImpl type)
createBuiltinListback to summary
private static XSDatatypeImpl createBuiltinList(String name, XSDatatypeImpl item) throws DatatypeException
createInitialBuiltinTypesMapback to summary
private static Map<K, V> createInitialBuiltinTypesMap()

creates a map that contains frequently-used built-in types

deriveByListback to summary
public static XSDatatype deriveByList(String nsUri, String newTypeName, XSDatatype itemType) throws DatatypeException

derives a new type by list. See http://www.w3.org/TR/xmlschema-2#derivation-by-list for what "derivation by list" means.

Parameters
nsUri:String

(URI,local) pair as the name of the new type. it can be set to null for an anonymous type.

itemType:XSDatatype

Type of the list item. It must be an atom type which is implemented in this package or derived from types implemented in this package. You cannot use your own DataType implementation here.

Returns:XSDatatype

always return non-null value. If error occurs, then an exception will be thrown.

Exceptions
DatatypeException:
this exception is thrown when the derivation is illegal. For example, when you try to derive a type from non-atom type.
deriveByListback to summary
public static XSDatatype deriveByList(String newTypeName, XSDatatype itemType) throws DatatypeException

Deprecated

deriveByUnionback to summary
public static XSDatatype deriveByUnion(String nsUri, String newTypeName, XSDatatype[] memberTypes) throws DatatypeException

derives a new type by union. See http://www.w3.org/TR/xmlschema-2#derivation-by-union for what "derivation by union" means.

Parameters
newTypeName:String

name of the new type. it can be set to null to indicate an anonymous type.

memberTypes:XSDatatype[]

Types of the union member. It can be any type that implements DataType.

Exceptions
DatatypeException:
this exception is thrown when the derivation is illegal.
deriveByUnionback to summary
public static XSDatatype deriveByUnion(String newTypeName, XSDatatype[] memberTypes) throws DatatypeException

Deprecated

deriveByUnionback to summary
public static XSDatatype deriveByUnion(String newTypeName, Collection<E> memberTypes) throws DatatypeException

Deprecated

deriveByUnionback to summary
public static XSDatatype deriveByUnion(String nsUri, String newTypeName, Collection<E> memberTypes) throws DatatypeException
getTypeByNameback to summary
public static synchronized XSDatatype getTypeByName(String dataTypeName) throws DatatypeException

obtain a built-in DataType object by its name. For example, you can pass somethings like "token", "gYear", etc.

Returns:XSDatatype

A non-null valid datatype object.

Exceptions
DatatypeException:
If the type name is undefined.