org.mmbase.bridge.util
Class DataTypeField

java.lang.Object
  extended by org.mmbase.core.AbstractDescriptor
      extended by org.mmbase.core.AbstractField
          extended by org.mmbase.bridge.util.DataTypeField
All Implemented Interfaces:
Cloneable, Comparable<Field>, Descriptor, Field, PublicCloneable<AbstractDescriptor>
Direct Known Subclasses:
MockField, MockNodeManager.SystemField

public class DataTypeField
extends AbstractField

Wraps a DataType object into a (virtual) Field object. It can be instantiated with DataTypeField(Cloud, DataType) to have a 'virtual field with a Virtual NodeManager with only one field (itself). The constructor DataTypeField(Field, DataType), produces a new field object, that is very similar to the one wrapped, only with a different DataType. This also a way to associate a Cloud object with a DataType (it is actually possible to see that as the essence of being a Field).

Since:
MMBase-1.8.7
Version:
$Id: DataTypeField.java 39794 2009-11-18 21:43:52Z michiel $
Author:
Michiel Meeuwissen

Field Summary
protected  Field field
           
protected  NodeManager nodeManager
           
 
Fields inherited from class org.mmbase.core.AbstractField
dataType, listItemType, readOnly, state, type
 
Fields inherited from class org.mmbase.core.AbstractDescriptor
description, guiName, key
 
Fields inherited from interface org.mmbase.bridge.Field
STATE_PERSISTENT, STATE_SYSTEM, STATE_SYSTEM_VIRTUAL, STATE_UNKNOWN, STATE_VIRTUAL, TYPE_BINARY, TYPE_BOOLEAN, TYPE_BYTE, TYPE_DATETIME, TYPE_DECIMAL, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_LIST, TYPE_LONG, TYPE_NODE, TYPE_STRING, TYPE_UNKNOWN, TYPE_XML
 
Constructor Summary
DataTypeField(Cloud cloud, DataType<? extends Object> dataType)
           
DataTypeField(Field field, DataType<? extends Object> dataType)
          This constructor only wraps the given field to have another datatype.
DataTypeField(NodeManager nm, Field f)
           
DataTypeField(String name, NodeManager nm, DataType<? extends Object> dataType)
           
 
Method Summary
 int getEditPosition()
          Retrieve the position of the field when editing.
 String getGUIType()
          Returns the GUI name for the data type this field contains.
 int getListPosition()
          Retrieve the position of the field when listing.
 int getMaxLength()
          Returns the maximum length of data this field can contain.
 NodeManager getNodeManager()
          Returns the node manager this field belongs to.
 int getSearchPosition()
          Retrieve the position of the field when searching.
 int getStoragePosition()
          Retrieve the position of the field in the database table.
 boolean isReadOnly()
          Returns whether a field is a read only.
 Collection<String> validate(Object value)
          Checks whether a given value is valid for this field.
 
Methods inherited from class org.mmbase.core.AbstractField
clone, clone, compareTo, equals, getDataType, getListItemType, getState, getType, hashCode, hasIndex, isRequired, isTemporary, isUnique, isVirtual, setDataType, setState, toString
 
Methods inherited from class org.mmbase.core.AbstractDescriptor
clone, getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.Descriptor
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName
 

Field Detail

nodeManager

protected final NodeManager nodeManager

field

protected final Field field
Constructor Detail

DataTypeField

public DataTypeField(Cloud cloud,
                     DataType<? extends Object> dataType)

DataTypeField

public DataTypeField(NodeManager nm,
                     Field f)
Since:
MMBase-1.9.2

DataTypeField

public DataTypeField(String name,
                     NodeManager nm,
                     DataType<? extends Object> dataType)
Since:
MMBase-1.9.2

DataTypeField

public DataTypeField(Field field,
                     DataType<? extends Object> dataType)
This constructor only wraps the given field to have another datatype.

Since:
MMBase-1.9
Method Detail

getNodeManager

public NodeManager getNodeManager()
Description copied from interface: Field
Returns the node manager this field belongs to.

Specified by:
getNodeManager in interface Field
Specified by:
getNodeManager in class AbstractField
Returns:
the node manager this field belongs to

getSearchPosition

public int getSearchPosition()
Description copied from interface: Field
Retrieve the position of the field when searching. A value of -1 indicates the field is unavailable during search.

Specified by:
getSearchPosition in interface Field
Specified by:
getSearchPosition in class AbstractField
Returns:
position of the field when searching

getListPosition

public int getListPosition()
Description copied from interface: Field
Retrieve the position of the field when listing. A value of -1 indicates the field is unavailable in a list.

Specified by:
getListPosition in interface Field
Specified by:
getListPosition in class AbstractField
Returns:
position of the field when listing

getEditPosition

public int getEditPosition()
Description copied from interface: Field
Retrieve the position of the field when editing. A value of -1 indicates the field cannot be edited.

Specified by:
getEditPosition in interface Field
Specified by:
getEditPosition in class AbstractField
Returns:
position of the field when editing

getStoragePosition

public int getStoragePosition()
Description copied from interface: Field
Retrieve the position of the field in the database table.

Specified by:
getStoragePosition in interface Field
Specified by:
getStoragePosition in class AbstractField
Returns:
position in the database table

getMaxLength

public int getMaxLength()
Description copied from interface: Field
Returns the maximum length of data this field can contain. For example if a field contains characters the size indicates the maximum number of characters it can contain. If the field is a numeric field (such as an integer), the result is -1. For a 'decimal' type though, this returns the same as the precision of the associated datatype.

Specified by:
getMaxLength in interface Field
Specified by:
getMaxLength in class AbstractField
Returns:
the maximum length of data this field can contain

isReadOnly

public boolean isReadOnly()
Description copied from class: AbstractField
Returns whether a field is a read only.

Specified by:
isReadOnly in interface Field
Overrides:
isReadOnly in class AbstractField
Returns:
true when read only
See Also:
Field.isVirtual()

getGUIType

public String getGUIType()
Description copied from interface: Field
Returns the GUI name for the data type this field contains.

Specified by:
getGUIType in interface Field
Specified by:
getGUIType in class AbstractField
Returns:
the GUI name
See Also:
Field.getDataType()

validate

public Collection<String> validate(Object value)
Description copied from interface: Field
Checks whether a given value is valid for this field.

Parameters:
value - value to validate
Returns:
Collection of error-strings (describing the problem) in the current locale, or an empty collection if the value is ok.


MMBase 2.0-SNAPSHOT - null