public class DatatypeFactory
extends java.lang.Object
Applications should use this class to get and derive DataType objects. All methods are static.
Derivation by restriction should be done by using TypeIncubator
.
Modifier and Type | Field and Description |
---|---|
private static java.util.Map |
builtinType
a map that contains built in types.
|
Modifier | Constructor and Description |
---|---|
private |
DatatypeFactory() |
Modifier and Type | Method and Description |
---|---|
private static void |
add(java.util.Map m,
XSDatatypeImpl type) |
private static XSDatatypeImpl |
createBuiltinList(java.lang.String name,
XSDatatypeImpl item) |
private static java.util.Map |
createInitialBuiltinTypesMap()
creates a map that contains frequently-used built-in types
|
static XSDatatype |
deriveByList(java.lang.String nsUri,
java.lang.String newTypeName,
XSDatatype itemType)
derives a new type by list.
|
static XSDatatype |
deriveByList(java.lang.String newTypeName,
XSDatatype itemType)
Deprecated.
|
static XSDatatype |
deriveByUnion(java.lang.String newTypeName,
java.util.Collection memberTypes)
Deprecated.
|
static XSDatatype |
deriveByUnion(java.lang.String nsUri,
java.lang.String newTypeName,
java.util.Collection memberTypes) |
static XSDatatype |
deriveByUnion(java.lang.String nsUri,
java.lang.String newTypeName,
XSDatatype[] memberTypes)
derives a new type by union.
|
static XSDatatype |
deriveByUnion(java.lang.String newTypeName,
XSDatatype[] memberTypes)
Deprecated.
|
static XSDatatype |
getTypeByName(java.lang.String dataTypeName)
obtain a built-in DataType object by its name.
|
private static final java.util.Map builtinType
public static XSDatatype deriveByList(java.lang.String nsUri, java.lang.String newTypeName, XSDatatype itemType) throws org.relaxng.datatype.DatatypeException
nsUri,newTypeName
- (URI,local) pair as the
name of the new type. it can be set to null for an anonymous type.itemType
- 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.org.relaxng.datatype.DatatypeException
- this exception is thrown when the derivation is illegal.
For example, when you try to derive a type from non-atom type.public static XSDatatype deriveByList(java.lang.String newTypeName, XSDatatype itemType) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
public static XSDatatype deriveByUnion(java.lang.String nsUri, java.lang.String newTypeName, XSDatatype[] memberTypes) throws org.relaxng.datatype.DatatypeException
newTypeName
- name of the new type. it can be set to null to
indicate an anonymous type.memberTypes
- Types of the union member. It can be any type that implements DataType.org.relaxng.datatype.DatatypeException
- this exception is thrown when the derivation is illegal.public static XSDatatype deriveByUnion(java.lang.String newTypeName, XSDatatype[] memberTypes) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
public static XSDatatype deriveByUnion(java.lang.String newTypeName, java.util.Collection memberTypes) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
public static XSDatatype deriveByUnion(java.lang.String nsUri, java.lang.String newTypeName, java.util.Collection memberTypes) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
private static void add(java.util.Map m, XSDatatypeImpl type)
public static XSDatatype getTypeByName(java.lang.String dataTypeName) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
- If the type name is undefined.private static XSDatatypeImpl createBuiltinList(java.lang.String name, XSDatatypeImpl item) throws org.relaxng.datatype.DatatypeException
org.relaxng.datatype.DatatypeException
private static java.util.Map createInitialBuiltinTypesMap()