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 voidclear()Sets the DataField's value tonullDataFieldclone()static ObjectconvertType(Object o, int targetType)StringcreateEtag()Booleanequals(DataField dataField)Returnstruein case the given DataField object equals the current DataField object,falseotherwise.Booleanequals(String pattern)Returnstruein case the given DataField object equals the current DataField object,falseotherwise.Booleanequals(String pattern, boolean caseSensitive, boolean trimmed)Returnstruein case the given DataField object equals the current DataField object,falseotherwise.ArraygetArray()Returns the DataField's value asjava.sql.Arrayobject.StringgetAttribute(String attributeName)Returns the value for the given attribute name.Map<String,String>getAttributes()Returns ajava.util.HashMapobject with the DataField's attributes and their corresponding value.Map<String,Attribute>getAttributes2()BigDecimalgetBigDecimal()Returns the DataField's value asjava.math.BigDecimalobject.BlobgetBlob()Returns the DataField's value asjava.sql.Blobobject.BooleangetBoolean()Returns the DataField's value asjava.lang.Booleanobject.BytegetByte()Returns the DataField's value asjava.lang.Byteobject.byte[]getBytes()Returns the DataField's value as byte array.StringgetClassName()Returns the class name of the DataField's value object.ClobgetClob()Returns the DataField's value asjava.sql.Clobobject.DategetDate()Returns the DataField's value asjava.sql.Dateobject.DoublegetDouble()Returns the DataField's value asjava.lang.Doubleobject.StringgetEtag()FloatgetFloat()Returns the DataField's value asjava.lang.Floatobject.IntegergetInt()Returns the DataField's value asjava.lang.Integerobject.LonggetLong()Returns the DataField's value asjava.lang.Longobject.NClobgetNClob()Returns the DataField's value asjava.sql.NClobobject.ObjectgetObject()Returns the DataField's value.RefgetRef()Returns the DataField's value asjava.sql.Refobject.ShortgetShort()Returns the DataField's value asjava.lang.Shortobject.SQLXMLgetSQLXML()Returns the DataField's value asjava.sql.SQLXMLobject.StringgetString()Returns the DataField's value asjava.lang.Stringobject.TimegetTime()Returns the DataField's value asjava.sql.Timeobject.TimestampgetTimestamp()Returns the DataField's value asjava.sql.Timestampobject.URLgetURL()Returns the DataField's value asjava.net.URLobject.ObjectgetValue()Returns the DataField's value.voidremoveAttribute(String attributeName)Removes the attribute with the given name.voidsetAttribute(String attributeName, Attribute attributeValue)voidsetAttribute(String attributeName, String attributeValue)Sets the value of the attribute with the given name.voidsetAttributes(Map<String,String> attributes)Sets the attributes for this DataField.voidsetValue(Object value)Sets the given object as the DataField's valueStringtoString()
-
-
-
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)
Returnstruein case the given DataField object equals the current DataField object,falseotherwise. 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)
Returnstruein case the given DataField object equals the current DataField object,falseotherwise. 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)
Returnstruein case the given DataField object equals the current DataField object,falseotherwise. 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.Stringobject.- Returns:
- value The DataField's value as
java.lang.Stringobject.
-
getInt
public Integer getInt()
Returns the DataField's value asjava.lang.Integerobject.- Returns:
- value The DataField's value as
java.lang.Integerobject.
-
getByte
public Byte getByte()
Returns the DataField's value asjava.lang.Byteobject.- Returns:
- value The DataField's value as
java.lang.Byteobject.
-
getShort
public Short getShort()
Returns the DataField's value asjava.lang.Shortobject.- Returns:
- value The DataField's value as
java.lang.Shortobject.
-
getLong
public Long getLong()
Returns the DataField's value asjava.lang.Longobject.- Returns:
- value The DataField's value as
java.lang.Longobject.
-
getBigDecimal
public BigDecimal getBigDecimal()
Returns the DataField's value asjava.math.BigDecimalobject.- Returns:
- value The DataField's value as
java.math.BigDecimalobject.
-
getDouble
public Double getDouble()
Returns the DataField's value asjava.lang.Doubleobject.- Returns:
- value The DataField's value as
java.lang.Doubleobject.
-
getFloat
public Float getFloat()
Returns the DataField's value asjava.lang.Floatobject.- Returns:
- value The DataField's value as
java.lang.Floatobject.
-
getDate
public Date getDate()
Returns the DataField's value asjava.sql.Dateobject.- Returns:
- value The DataField's value as
java.sql.Dateobject.
-
getTime
public Time getTime()
Returns the DataField's value asjava.sql.Timeobject.- Returns:
- value The DataField's value as
java.sql.Timeobject.
-
getTimestamp
public Timestamp getTimestamp()
Returns the DataField's value asjava.sql.Timestampobject.- Returns:
- value The DataField's value as
java.sql.Timestampobject.
-
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.Arrayobject.- Returns:
- value The DataField's value as
java.sql.Arrayobject.
-
getBlob
public Blob getBlob()
Returns the DataField's value asjava.sql.Blobobject.- Returns:
- value The DataField's value as
java.sql.Blobobject.
-
getClob
public Clob getClob()
Returns the DataField's value asjava.sql.Clobobject.- Returns:
- value The DataField's value as
java.sql.Clobobject.
-
getNClob
public NClob getNClob()
Returns the DataField's value asjava.sql.NClobobject.- Returns:
- value The DataField's value as
java.sql.NClobobject.
-
getBoolean
public Boolean getBoolean()
Returns the DataField's value asjava.lang.Booleanobject.- Returns:
- value The DataField's value as
java.lang.Booleanobject.
-
getRef
public Ref getRef()
Returns the DataField's value asjava.sql.Refobject.- Returns:
- value The DataField's value as
java.sql.Refobject.
-
getURL
public URL getURL()
Returns the DataField's value asjava.net.URLobject.- Returns:
- value The DataField's value as
java.net.URLobject.
-
getSQLXML
public SQLXML getSQLXML()
Returns the DataField's value asjava.sql.SQLXMLobject.- Returns:
- value The DataField's value as
java.sql.SQLXMLobject.
-
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.nullis 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.HashMapobject with the DataField's attributes and their corresponding value.- Returns:
- attributesMap The
java.util.HashMapobject 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.HashMapobject 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()
-
-