| java.lang.Object org.mmbase.datatypes.DataTypes
DataTypes | public class DataTypes (Code) | |
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).
author: Pierre van Rooden since: MMBase-1.8 version: $Id: DataTypes.java,v 1.27 2008/01/28 16:31:29 michiel Exp $ |
addFinalDataType | public static DataType addFinalDataType(BasicDataType dataType)(Code) | | Add an instance of a DataType to the set of data types that are available thoughout the application.
The datatype should have a proper name, and not occur already in the set.
Note that the datatype is finished when added (if it wasn't already), and can thereafter not be changed.
Parameters: dataType - the datatype to add the dataType added. throws: IllegalArgumentException - if the datatype does not have a name or already occurs in the set |
createDataType | public static BasicDataType<C> createDataType(String name, Class<C> classType)(Code) | | Create an instance of a DataType based on the class passed.
The DataType returned is, if possible, a specialized DataType (such as
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).
Parameters: name - The name of the datatype to create. If null is passed, the class name is used. Parameters: classType - The class of the datatype to create. If null is passed, thedataType returned is based on Object.class. |
getDataType | public static synchronized BasicDataType getDataType(String name)(Code) | | Returns a DataType from the the available set of datatypes accessible throughout the application,
or null if that type does not exist.
Parameters: name - the name of the DataType to look for A DataType instance or null if none can be found |
getDataType | public static synchronized BasicDataType getDataType(int type)(Code) | | Returns the basic DataType that matches the passed type.
The datatype is retrieved from the available set of datatypes accessible throughout the application.
If this datatype does not (yet) exists, an instance is automatically created and added.
The datatype returned by this method is only useful for matching or cloning - it cannot be changed.
Parameters: type - the base type whose DataType to return the DataType instance |
getDataTypeInstance | public static synchronized BasicDataType getDataTypeInstance(String name, BasicDataType baseDataType)(Code) | | Returns a DataType instance.
The system first tries to obtain a data type from the available set of datatypes
accessible throughout the application. If a DataType of the passed name exists, a clone of that DataType is returned.
Otherwise, a clone of the base DataType passed is returned.
if the DataType with the passed name does not exist, and the value passed for the baseDataType is null ,
the method returns null .
Parameters: name - the name of the DataType to look for Parameters: baseDataType - the dataType to match against. Can be null . A DataType instance or null if none can be instantiated |
getDataTypeInstance | public static synchronized BasicDataType getDataTypeInstance(String name, int type)(Code) | | Returns a DataType instance.
The system first tries to obtain a type from the available set of datatypes
accessible throughout the application. If a DataType of the passed name exists,
a clone of that DataType is returned. Otherwise, an instance of a DataType based
on the base type is returned.
Parameters: name - the name of the DataType to look for Parameters: type - the base type to use for a default datatype instance A DataType instance |
getListDataType | public static ListDataType getListDataType(int listItemType)(Code) | | Returns the basic ListDataType whose item's DataType matches the passed type.
The datatype is retrieved from the available set of datatypes accessible throughout the application.
If this datatype does not (yet) exists, an instance is automatically created and added.
The datatype returned by this method is only useful for matching or cloning - it cannot be changed.
Parameters: listItemType - the base type whose ListDataType to return the ListDataType instance |
getListDataTypeInstance | public static synchronized ListDataType getListDataTypeInstance(String name, int listItemType)(Code) | | Returns a ListDataType instance.
The system first tries to obtain a type from the available set of datatypes
accessible throughout the application. If a DataType of the passed name exists,
a clone of that DataType is returned. Otherwise, an instance of a ListDataType based
on the list item type is returned.
Parameters: name - the name of the DataType to look for Parameters: listItemType - the base type to use for a default listdatatype instance(this type determines the type of the list elements) A ListDataType instance |
initialize | public static void initialize()(Code) | | |
toXml | public static Document toXml(DataType> dataType)(Code) | | Returns a new XML completely describing the given DataType.
This means that the XML will not have a base attribute.
|
|
|