public class DataObject
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DataObject.ObjectType |
static interface |
DataObject.ValueParser<T>
A value parser tries to convert the object from its source to target type.
|
Constructor and Description |
---|
DataObject(java.lang.Object value,
DataObject.ObjectType type)
Get a DataObject with the default parser
|
DataObject(java.lang.Object value,
DataObject.ObjectType type,
DataObject.ValueParser parser)
Get a DataObject with a custom parser
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
An object is equal if it is an instance of DataObject, the ObjectType is equivalent, and the equals method on the contained object returns true.
|
java.math.BigDecimal |
getBigDecimal()
Retrieve the object as a BigDecimal or throws a ClassCastException if it can't
|
java.lang.Boolean |
getBoolean()
Retrieve the object as a Boolean or throws a ClassCastException if it can't
|
java.lang.Byte |
getByte()
Retrieve the object as a Byte or throws a ClassCastException if it can't
|
byte[] |
getBytes()
Retrieve the object as a Byte[] or throws a ClassCastException if it can't
|
java.sql.Date |
getDate()
Retrieve the object as a java.sql.Date or throws a ClassCastException if it can't
|
java.lang.Double |
getDouble()
Retrieve the object as a Double or throws a ClassCastException if it can't
|
java.lang.Float |
getFloat()
Retrieve the object as a Float or throws a ClassCastException if it can't
|
java.io.InputStream |
getInputStream()
Retrieve the object as an InputStream.
|
java.lang.Integer |
getInt()
Retrieve the object as a Integer or throws a ClassCastException if it can't
|
java.lang.Long |
getLong()
Retrieve the object as a Long or throws a ClassCastException if it can't
|
java.lang.Object |
getObject()
Return the object that is contained in the DataObject
|
java.lang.Short |
getShort()
Retrieve the object as a Short or throws a ClassCastException if it can't
|
java.lang.String |
getString()
Retrieve the object as a String
|
java.sql.Time |
getTime()
Retrieve the object as a java.sql.Time or throws a ClassCastException if it can't
|
java.sql.Timestamp |
getTimestamp()
Retrieve the object as a java.sql.Timestamp or throws a ClassCastException if it can't
|
DataObject.ObjectType |
getType()
gets the ObjectType of the DataObject.
|
int |
hashCode()
The hashcode is calculated based on the ObjectType and contained object
|
static byte[] |
serializeObject(java.lang.Object o)
Attempt to serialize the given object
|
java.lang.String |
toString() |
public DataObject(@Nullable java.lang.Object value, @Nullable DataObject.ObjectType type, @NotNull DataObject.ValueParser parser)
value
- type
- parser
- public DataObject(@Nullable java.lang.Object value, @Nullable DataObject.ObjectType type)
value
- type
- @Nullable public DataObject.ObjectType getType()
@Nullable public java.lang.Object getObject()
public static byte[] serializeObject(java.lang.Object o)
o
- The object to serializepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to check for equalitypublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
@Nullable public java.math.BigDecimal getBigDecimal()
@Nullable public java.lang.Boolean getBoolean()
public java.lang.Byte getByte()
@Nullable public java.sql.Date getDate()
@Nullable public java.sql.Time getTime()
@Nullable public java.sql.Timestamp getTimestamp()
public java.lang.Double getDouble()
public java.lang.Float getFloat()
public java.lang.Integer getInt()
public java.lang.Long getLong()
public java.lang.Short getShort()
@Nullable public byte[] getBytes()
@Nullable public java.lang.String getString()
@Nullable public java.io.InputStream getInputStream()