org.mmbase.core.util
Class Fields

java.lang.Object
  extended byorg.mmbase.core.util.Fields

public class Fields
extends Object

Since:
MMBase-1.8

Field Summary
static int STATE_MAXVALUE
           
static int STATE_MINVALUE
           
static int TYPE_MAXVALUE
           
static int TYPE_MINVALUE
           
 
Constructor Summary
Fields()
           
 
Method Summary
static int classToType(Class classType)
          Determines the MMBase type of a specified class.
static CoreField createField(String name, int type, int listItemType, int state, DataType dataType)
          Returns an instance of a CoreField based on the type and state.
static CoreField createSystemField(String name, int type)
          Returns an instance of a CoreField based on the type, with state 'SYSTEM', and a basic datatype assigned.
static int getState(String state)
          Provide an id for the specified mmbase state description.
static String getStateDescription(int state)
          Provide a description for the specified state.
static int getType(String type)
          Provide an id for the specified mmbase type description
static String getTypeDescription(int type)
          Provide a description for the specified type.
static void sort(List fields, int order)
           
static Class typeToClass(int type)
          Determines the class for a specified MMBase base type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_MINVALUE

public static final int STATE_MINVALUE
See Also:
Constant Field Values

STATE_MAXVALUE

public static final int STATE_MAXVALUE
See Also:
Constant Field Values

TYPE_MINVALUE

public static final int TYPE_MINVALUE
See Also:
Constant Field Values

TYPE_MAXVALUE

public static final int TYPE_MAXVALUE
See Also:
Constant Field Values
Constructor Detail

Fields

public Fields()
Method Detail

createSystemField

public static CoreField createSystemField(String name,
                                          int type)
Returns an instance of a CoreField based on the type, with state 'SYSTEM', and a basic datatype assigned.

Parameters:
name - The name of the field
type - the MMBase basic field type, one of the Field TYPE constants. Specifying Field.TYPE_LIST, may give unpredictable results.

createField

public static CoreField createField(String name,
                                    int type,
                                    int listItemType,
                                    int state,
                                    DataType dataType)
Returns an instance of a CoreField based on the type and state.

Parameters:
name - The name of the field
type - the MMBase basic field type, one of the Field TYPE constants.
listItemType - the MMBase type for items of a list (if type is Field.TYPE_LIST).
state - the MMBase field state, one of the Field STATE constants.
dataType - the dataType to use for validating the field data. If null, a default datatype is assigned

getTypeDescription

public static String getTypeDescription(int type)
Provide a description for the specified type. Useful for debugging, errors or presenting GUI info.

Parameters:
type - the type to get the description of
Returns:
the description of the type.

getStateDescription

public static String getStateDescription(int state)
Provide a description for the specified state. Useful for debugging, errors or presenting GUI info.

Parameters:
state - the state to get the description of
Returns:
the description of the state.

getState

public static int getState(String state)
Provide an id for the specified mmbase state description.

Parameters:
state - the state description to get the id of
Returns:
the id of the state.

getType

public static int getType(String type)
Provide an id for the specified mmbase type description

Parameters:
type - the type description to get the id of
Returns:
the id of the type.

classToType

public static int classToType(Class classType)
Determines the MMBase type of a specified class. The MMBase base type is sue by the storage layer to determine how to store a field. If the base type cannot be determined from the class, the value returned is Field.TYPE_UNKNOWN.

Parameters:
classType -
Returns:
an MMBase base type constant

typeToClass

public static Class typeToClass(int type)
Determines the class for a specified MMBase base type. If the value is Field.TYPE_UNKNOWN), the method returns null.

Parameters:
type -
Returns:
an MMBase base type constant

sort

public static void sort(List fields,
                        int order)


MMBase build 1.8.1.20060716