|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knime.core.data.util.ObjectToDataCellConverter
DefaultTable is deprecated. DataCell
objects should be created using their respective constructor rather than
using an ObjectToDataCellConverter.
public class ObjectToDataCellConverter
Factory to get DataCell representation for various
(java-)objects.
This class is used within the DefaultTable to wrap
java objects in DataCell. If you implement your own
DataCell and use the DefaultTable, you
probably want to override this class.
This default implementation serves to get DataCell instances
for basic java objects like String, Integer,
Double and their generic types like int,
byte, double etc.
To implement additional functionality, you usually override the proper
createDataCell method like this:
ObjectToDataCellConverter converter = new ObjectToDataCellConverter() {
public DataCell createDataCell(final Object o) {
if (o instanceof FooObject) {
return new FooDataCell((FooObject)o);
}
if (o instanceof FooBarObject) {
return new FooBarDataCell((FooBarObject)o);
}
return super.createDataCell(o);
}
};
It is also up to the user to implement further handling in the factory method
for generic data types.
DefaultTable.DefaultTable(
Object[][], String[], String[], ObjectToDataCellConverter)| Field Summary | |
|---|---|
static ObjectToDataCellConverter |
INSTANCE
Deprecated. Singleton to be used for default handling. |
| Constructor Summary | |
|---|---|
ObjectToDataCellConverter()
Deprecated. |
|
| Method Summary | |
|---|---|
DataCell |
createDataCell(boolean b)
Deprecated. Creates new IntCell for a boolean having value
1 if b==true or 0 if b==false. |
DataCell |
createDataCell(byte b)
Deprecated. Creates new IntCell for a byte. |
DataCell |
createDataCell(double d)
Deprecated. Creates new DoubleCell for a double. |
DataCell |
createDataCell(float f)
Deprecated. Creates new DoubleCell for a float. |
DataCell |
createDataCell(int i)
Deprecated. Creates new IntCell for an int. |
DataCell |
createDataCell(Object o)
Deprecated. Factory method to get DataCells from basic types. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ObjectToDataCellConverter INSTANCE
| Constructor Detail |
|---|
public ObjectToDataCellConverter()
| Method Detail |
|---|
public DataCell createDataCell(Object o)
DataCells from basic types. This
implementation creates DataCells depending on the class
type of o as follows:
Class or value of o |
Return class |
|---|---|
null |
StringCell.INSTANCE |
String | StringCell |
Integer | IntCell |
Byte | IntCell |
Double | DoubleCell |
Float | DoubleCell |
o - The object to be converted into a DataCell or
null to indicate a missing value.
DataCell representing o.
IllegalArgumentException - if o is not an instance
of the classes mentioned above. Derivates may override this
behavior.public DataCell createDataCell(double d)
DoubleCell for a double.
d - Double to be wrapped in a DataCell
new DoubleCell(d);DoubleCellpublic DataCell createDataCell(float f)
DoubleCell for a float.
f - Float to be wrapped in a DataCell
new DoubleCell((double)f);DoubleCellpublic DataCell createDataCell(int i)
IntCell for an int.
i - Int to be wrapped in a DataCell
new IntCell(i);IntCellpublic DataCell createDataCell(byte b)
IntCell for a byte.
b - Byte to be wrapped in a DataCell
new IntCell((int)b);IntCellpublic DataCell createDataCell(boolean b)
IntCell for a boolean having value
1 if b==true or 0 if b==false.
b - Boolean to be wrapped in a DataCell
IntCell having either value 1 or 0
depending on bIntCell
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||