com.sun.msv.datatype.xsd
Class DatatypeFactory

java.lang.Object
  extended bycom.sun.msv.datatype.xsd.DatatypeFactory

public class DatatypeFactory
extends Object

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

Method Summary
static XSDatatype deriveByList(String nsUri, String newTypeName, XSDatatype itemType)
          derives a new type by list.
static XSDatatype deriveByList(String newTypeName, XSDatatype itemType)
          Deprecated.  
static XSDatatype deriveByUnion(String newTypeName, Collection memberTypes)
          Deprecated.  
static XSDatatype deriveByUnion(String nsUri, String newTypeName, Collection memberTypes)
           
static XSDatatype deriveByUnion(String nsUri, String newTypeName, XSDatatype[] memberTypes)
          derives a new type by union.
static XSDatatype deriveByUnion(String newTypeName, XSDatatype[] memberTypes)
          Deprecated.  
static XSDatatype getTypeByName(String dataTypeName)
          obtain a built-in DataType object by its name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deriveByList

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:
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.
Returns:
always return non-null value. If error occurs, then an exception will be thrown.
Throws:
DatatypeException - this exception is thrown when the derivation is illegal. For example, when you try to derive a type from non-atom type.

deriveByList

public static XSDatatype deriveByList(String newTypeName,
                                      XSDatatype itemType)
                               throws DatatypeException
Deprecated.  

Throws:
DatatypeException

deriveByUnion

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 - 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.
Throws:
DatatypeException - this exception is thrown when the derivation is illegal.

deriveByUnion

public static XSDatatype deriveByUnion(String newTypeName,
                                       XSDatatype[] memberTypes)
                                throws DatatypeException
Deprecated.  

Throws:
DatatypeException

deriveByUnion

public static XSDatatype deriveByUnion(String newTypeName,
                                       Collection memberTypes)
                                throws DatatypeException
Deprecated.  

Throws:
DatatypeException

deriveByUnion

public static XSDatatype deriveByUnion(String nsUri,
                                       String newTypeName,
                                       Collection memberTypes)
                                throws DatatypeException
Throws:
DatatypeException

getTypeByName

public static 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:
A non-null valid datatype object.
Throws:
DatatypeException - If the type name is undefined.