Package com.basiscomponents.db
Class DataField
- java.lang.Object
-
- com.basiscomponents.db.DataField
-
- All Implemented Interfaces:
Serializable
public class DataField extends Object implements Serializable
The DataField class is an object container class which provides multiple cast methods to retrieve the initially stored object in different formats / types.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Sets the DataField's value tonull
DataField
clone()
static Object
convertType(Object o, int targetType)
String
createEtag()
Boolean
equals(DataField dataField)
Returnstrue
in case the given DataField object equals the current DataField object,false
otherwise.Boolean
equals(String pattern)
Returnstrue
in case the given DataField object equals the current DataField object,false
otherwise.Boolean
equals(String pattern, boolean caseSensitive, boolean trimmed)
Returnstrue
in case the given DataField object equals the current DataField object,false
otherwise.Array
getArray()
Returns the DataField's value asjava.sql.Array
object.String
getAttribute(String attributeName)
Returns the value for the given attribute name.Map<String,String>
getAttributes()
Returns ajava.util.HashMap
object with the DataField's attributes and their corresponding value.Map<String,Attribute>
getAttributes2()
BigDecimal
getBigDecimal()
Returns the DataField's value asjava.math.BigDecimal
object.Blob
getBlob()
Returns the DataField's value asjava.sql.Blob
object.Boolean
getBoolean()
Returns the DataField's value asjava.lang.Boolean
object.Byte
getByte()
Returns the DataField's value asjava.lang.Byte
object.byte[]
getBytes()
Returns the DataField's value as byte array.String
getClassName()
Returns the class name of the DataField's value object.Clob
getClob()
Returns the DataField's value asjava.sql.Clob
object.Date
getDate()
Returns the DataField's value asjava.sql.Date
object.Double
getDouble()
Returns the DataField's value asjava.lang.Double
object.String
getEtag()
Float
getFloat()
Returns the DataField's value asjava.lang.Float
object.Integer
getInt()
Returns the DataField's value asjava.lang.Integer
object.Long
getLong()
Returns the DataField's value asjava.lang.Long
object.NClob
getNClob()
Returns the DataField's value asjava.sql.NClob
object.Object
getObject()
Returns the DataField's value.Ref
getRef()
Returns the DataField's value asjava.sql.Ref
object.Short
getShort()
Returns the DataField's value asjava.lang.Short
object.SQLXML
getSQLXML()
Returns the DataField's value asjava.sql.SQLXML
object.String
getString()
Returns the DataField's value asjava.lang.String
object.Time
getTime()
Returns the DataField's value asjava.sql.Time
object.Timestamp
getTimestamp()
Returns the DataField's value asjava.sql.Timestamp
object.URL
getURL()
Returns the DataField's value asjava.net.URL
object.Object
getValue()
Returns the DataField's value.void
removeAttribute(String attributeName)
Removes the attribute with the given name.void
setAttribute(String attributeName, Attribute attributeValue)
void
setAttribute(String attributeName, String attributeValue)
Sets the value of the attribute with the given name.void
setAttributes(Map<String,String> attributes)
Sets the attributes for this DataField.void
setValue(Object value)
Sets the given object as the DataField's valueString
toString()
-
-
-
Constructor Detail
-
DataField
public DataField(Object value)
Creates the DataField object with the given object as the DataField's value- Parameters:
value
- The value object of the DataField to be created
-
-
Method Detail
-
getValue
public Object getValue()
Returns the DataField's value.- Returns:
- value the DataField's value
-
equals
public Boolean equals(DataField dataField)
Returnstrue
in case the given DataField object equals the current DataField object,false
otherwise. The method does only compare the value object of both DataField objects, not the attributes.- Parameters:
dataField
- The DataField object to compare with.- Returns:
- equal The boolean value indicating whether the given DataField object equals this DataField object.
-
equals
public Boolean equals(String pattern)
Returnstrue
in case the given DataField object equals the current DataField object,false
otherwise. The method does only compare the value object of both DataField objects, not the attributes.- Parameters:
pattern
- The DataField object to compare with.- Returns:
- equal The boolean value indicating whether the given DataField object equals this DataField object.
-
equals
public Boolean equals(String pattern, boolean caseSensitive, boolean trimmed)
Returnstrue
in case the given DataField object equals the current DataField object,false
otherwise. The method does only compare the value object of both DataField objects, not the attributes.- Parameters:
pattern
- The DataField object to compare with.- Returns:
- equal The boolean value indicating whether the given DataField object equals this DataField object.
-
setValue
public void setValue(Object value)
Sets the given object as the DataField's value- Parameters:
value
- The object to set as the DataField's value
-
getClassName
public String getClassName()
Returns the class name of the DataField's value object.- Returns:
- className The DataField value's class name.
-
getObject
public Object getObject()
Returns the DataField's value.- Returns:
- value The DataField's value.
-
getString
public String getString()
Returns the DataField's value asjava.lang.String
object.- Returns:
- value The DataField's value as
java.lang.String
object.
-
getInt
public Integer getInt()
Returns the DataField's value asjava.lang.Integer
object.- Returns:
- value The DataField's value as
java.lang.Integer
object.
-
getByte
public Byte getByte()
Returns the DataField's value asjava.lang.Byte
object.- Returns:
- value The DataField's value as
java.lang.Byte
object.
-
getShort
public Short getShort()
Returns the DataField's value asjava.lang.Short
object.- Returns:
- value The DataField's value as
java.lang.Short
object.
-
getLong
public Long getLong()
Returns the DataField's value asjava.lang.Long
object.- Returns:
- value The DataField's value as
java.lang.Long
object.
-
getBigDecimal
public BigDecimal getBigDecimal()
Returns the DataField's value asjava.math.BigDecimal
object.- Returns:
- value The DataField's value as
java.math.BigDecimal
object.
-
getDouble
public Double getDouble()
Returns the DataField's value asjava.lang.Double
object.- Returns:
- value The DataField's value as
java.lang.Double
object.
-
getFloat
public Float getFloat()
Returns the DataField's value asjava.lang.Float
object.- Returns:
- value The DataField's value as
java.lang.Float
object.
-
getDate
public Date getDate()
Returns the DataField's value asjava.sql.Date
object.- Returns:
- value The DataField's value as
java.sql.Date
object.
-
getTime
public Time getTime()
Returns the DataField's value asjava.sql.Time
object.- Returns:
- value The DataField's value as
java.sql.Time
object.
-
getTimestamp
public Timestamp getTimestamp()
Returns the DataField's value asjava.sql.Timestamp
object.- Returns:
- value The DataField's value as
java.sql.Timestamp
object.
-
getBytes
public byte[] getBytes()
Returns the DataField's value as byte array.- Returns:
- value The DataField's value as byte array.
-
getArray
public Array getArray()
Returns the DataField's value asjava.sql.Array
object.- Returns:
- value The DataField's value as
java.sql.Array
object.
-
getBlob
public Blob getBlob()
Returns the DataField's value asjava.sql.Blob
object.- Returns:
- value The DataField's value as
java.sql.Blob
object.
-
getClob
public Clob getClob()
Returns the DataField's value asjava.sql.Clob
object.- Returns:
- value The DataField's value as
java.sql.Clob
object.
-
getNClob
public NClob getNClob()
Returns the DataField's value asjava.sql.NClob
object.- Returns:
- value The DataField's value as
java.sql.NClob
object.
-
getBoolean
public Boolean getBoolean()
Returns the DataField's value asjava.lang.Boolean
object.- Returns:
- value The DataField's value as
java.lang.Boolean
object.
-
getRef
public Ref getRef()
Returns the DataField's value asjava.sql.Ref
object.- Returns:
- value The DataField's value as
java.sql.Ref
object.
-
getURL
public URL getURL()
Returns the DataField's value asjava.net.URL
object.- Returns:
- value The DataField's value as
java.net.URL
object.
-
getSQLXML
public SQLXML getSQLXML()
Returns the DataField's value asjava.sql.SQLXML
object.- Returns:
- value The DataField's value as
java.sql.SQLXML
object.
-
getEtag
public String getEtag()
-
setAttribute
public void setAttribute(String attributeName, String attributeValue)
Sets the value of the attribute with the given name. Creates the attribute if it doesn't exist.- Parameters:
attributeName
- The attribute's name.attributeValue
- The attribute's value.
-
getAttribute
public String getAttribute(String attributeName)
Returns the value for the given attribute name.null
is returned if no attribute matches the given name.- Parameters:
attributeName
- The attribute's name.- Returns:
- attributeValue The attribute's value.
-
getAttributes
public Map<String,String> getAttributes()
Returns ajava.util.HashMap
object with the DataField's attributes and their corresponding value.- Returns:
- attributesMap The
java.util.HashMap
object containing the DataField's attributes and their values.
-
setAttributes
public void setAttributes(Map<String,String> attributes)
Sets the attributes for this DataField.- Parameters:
attributes
- The attribute'sjava.util.HashMap
object with the attributes and their corresponding values.
-
removeAttribute
public void removeAttribute(String attributeName)
Removes the attribute with the given name. Nothing happens in case the name doesn't exist.- Parameters:
attributeName
- The name of the attribute to remove.
-
clear
public void clear()
Sets the DataField's value tonull
-
createEtag
public String createEtag()
-
-