public class DataTypes extends Object
This class contains various methods for manipulating DataType objects. It contains a static set of named DataType objects, with which it is possible to craete a set of datatypes that are accessable throught the MMBase application. This set contains, at the very least, the basic datatypes (a DataType for every 'MMBase' type, i.e. integer, string, etc). There can be only one DataType in a set with a given name, so it is not possible to have multiple registered datatypes with the same name.
A number of other methods in this class deal with conversion, creating datatypes, and 'finishing' datatypes (locking a datatype to protect it form being changed).
| Modifier and Type | Class and Description |
|---|---|
static class |
DataTypes.FieldNotFoundException |
| Constructor and Description |
|---|
DataTypes() |
| Modifier and Type | Method and Description |
|---|---|
static DataType |
addFinalDataType(BasicDataType dataType)
Add an instance of a DataType to the set of data types that are available thoughout the application.
|
static <C> BasicDataType<C> |
createDataType(String name,
Class<C> classType)
Create an instance of a DataType based on the class passed.
|
static BasicDataType |
getDataType(int type)
Returns the basic DataType that matches the passed type.
|
static BasicDataType |
getDataType(String name)
Returns a DataType from the the available set of datatypes accessible throughout the application,
or
null if that type does not exist. |
static BasicDataType |
getDataTypeForFieldAttribute(String fieldAttribute)
Get the datatype a defined for a certain field of a certain node manager, of a certain cloud context.
|
static BasicDataType |
getDataTypeInstance(String name,
BasicDataType baseDataType)
Returns a DataType instance.
|
static BasicDataType |
getDataTypeInstance(String name,
int type)
Returns a DataType instance.
|
static int |
getEnforceStrength(String enforce) |
static ListDataType |
getListDataType(int listItemType)
Returns the basic ListDataType whose item's DataType matches the passed type.
|
static ListDataType |
getListDataTypeInstance(String name,
int listItemType)
Returns a ListDataType instance.
|
static DataTypeCollector |
getSystemCollector() |
static void |
initialize() |
static void |
main(String[] arg) |
static void |
reinitialize() |
static Document |
toXml(DataType<?> dataType)
Returns a new XML completely describing the given DataType.
|
public static void initialize()
public static void reinitialize()
public static <C> BasicDataType<C> createDataType(String name, Class<C> classType)
IntegerDataType)
based on the MMBase Type that most closely matches the passed class. Otherwise, it is a generic DataType
specific for that class (with generally means that it only supports basic functionality such as autocast).name - The name of the datatype to create. If null is passed, the class name is used.classType - The class of the datatype to create. If null is passed, the
dataType returned is based on Object.class.public static DataType addFinalDataType(BasicDataType dataType)
dataType - the datatype to addIllegalArgumentException - if the datatype does not have a name or already occurs in the setpublic static BasicDataType getDataType(String name)
null if that type does not exist.name - the name of the DataType to look fornull if none can be foundpublic static BasicDataType getDataTypeForFieldAttribute(String fieldAttribute) throws DataTypes.FieldNotFoundException
fieldAttribute - The string describing the datatypeDataTypes.FieldNotFoundException - If the specified field could not be found (yet).public static BasicDataType getDataTypeInstance(String name, BasicDataType baseDataType)
null,
the method returns null.name - the name of the DataType to look forbaseDataType - the dataType to match against. Can be null.null if none can be instantiatedpublic static BasicDataType getDataTypeInstance(String name, int type)
name - the name of the DataType to look fortype - the base type to use for a default datatype instancepublic static ListDataType getListDataTypeInstance(String name, int listItemType)
name - the name of the DataType to look forlistItemType - the base type to use for a default listdatatype instance
(this type determines the type of the list elements)public static BasicDataType getDataType(int type)
type - the base type whose DataType to returnpublic static ListDataType getListDataType(int listItemType)
listItemType - the base type whose ListDataType to returnpublic static DataTypeCollector getSystemCollector()
public static Document toXml(DataType<?> dataType)
public static int getEnforceStrength(String enforce)
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}