javax.rad.model.datatype
Class DataType

java.lang.Object
  extended by javax.rad.model.datatype.DataType
All Implemented Interfaces:
Serializable, Cloneable, IDataType
Direct Known Subclasses:
BigDecimalDataType, BinaryDataType, BooleanDataType, ObjectDataType, StringDataType, TimestampDataType

public abstract class DataType
extends Object
implements IDataType, Serializable

A DataType is the abstract base class of all ColumnDefinition data types. They store type specific informations like size, precision, ...
It can also used to convert between a standard Java data type and a memory optimized storage Object.

On the other hand, it stores the ICellRenderer and ICellEditor. That is because in most cases the GUI control (drawing and editing) depends on the data type.

See Also:
Serialized Form

Constructor Summary
DataType()
           
 
Method Summary
 IDataType clone()
          Clone an IDataType.
 int compareTo(Object pObject1, Object pObject2)
          Compares IDataType objects in the rules of the Comparable interface.
 ICellEditor getCellEditor()
          Returns the CellEditor for this IDataType.
 ICellRenderer getCellRenderer()
          Returns the CellRenderer for this IDataType.
 int getSize()
          Returns the size of the DataType.
 int hashCode(Object pObject)
          Returns the hash code of the given object or null if the object is null.
 Object prepareValue(Object pObject)
          Prepares the given value.
 void setCellEditor(ICellEditor pCellEditor)
          Sets the CellEditor for this IDataType.
 void setCellRenderer(ICellRenderer pCellRenderer)
          Sets the CellRenderer for this IDataType.
 void setSize(int pSize)
          Sets the size of the DataType.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.rad.model.datatype.IDataType
convertAndCheckToTypeClass, convertToString, convertToTypeClass, getTypeClass, getTypeIdentifier
 

Constructor Detail

DataType

public DataType()
Method Detail

compareTo

public int compareTo(Object pObject1,
                     Object pObject2)
Compares IDataType objects in the rules of the Comparable interface. Implementations need to take care about to null objects are equal.

Specified by:
compareTo in interface IDataType
Parameters:
pObject1 - a getTypeClass() object of one IDataType
pObject2 - a getTypeClass() object of one IDataType
Returns:
-1 if pObject1 is smaller, 0 if equal and +1 if it is greater then pObject2

hashCode

public int hashCode(Object pObject)
Returns the hash code of the given object or null if the object is null.

Specified by:
hashCode in interface IDataType
Parameters:
pObject - a getTypeClass() object of one IDataType
Returns:
the hash code of the given object or null if the object is null.

clone

public IDataType clone()
Clone an IDataType.

Specified by:
clone in interface IDataType
Overrides:
clone in class Object
Returns:
a clone of this IDataType
See Also:
Object.clone()

prepareValue

public Object prepareValue(Object pObject)
                    throws ModelException
Prepares the given value.

This is used for preparing values for client-side usage and occurs before the client side receives the value for the first time.

If there is nothing to be done, the same object as passed in needs to be returned.

Specified by:
prepareValue in interface IDataType
Parameters:
pObject - the object to prepare.
Returns:
the prepared object. If there is nothing to do, the same object.
Throws:
ModelException - if the preparation failed.

setCellEditor

public void setCellEditor(ICellEditor pCellEditor)
Sets the CellEditor for this IDataType.

Specified by:
setCellEditor in interface IDataType
Parameters:
pCellEditor - the new ICellEditor

getCellEditor

public ICellEditor getCellEditor()
Returns the CellEditor for this IDataType.

Specified by:
getCellEditor in interface IDataType
Returns:
the CellEditor for this IDataType.

setCellRenderer

public void setCellRenderer(ICellRenderer pCellRenderer)
Sets the CellRenderer for this IDataType.

Specified by:
setCellRenderer in interface IDataType
Parameters:
pCellRenderer - the new ICellRenderer

getCellRenderer

public ICellRenderer getCellRenderer()
Returns the CellRenderer for this IDataType.

Specified by:
getCellRenderer in interface IDataType
Returns:
the CellRenderer for this IDataType.

getSize

public int getSize()
Returns the size of the DataType.

Returns:
the size of the DataType.

setSize

public void setSize(int pSize)
Sets the size of the DataType.

Parameters:
pSize - the size of the DataType.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.