Class TableFieldValue
- java.lang.Object
-
- org.silverpeas.components.mydb.model.TableFieldValue
-
- All Implemented Interfaces:
Comparable<TableFieldValue>
public class TableFieldValue extends Object implements Comparable<TableFieldValue>
The value of a field in a table row with its type (and associated type name) in the database.- Author:
- mmoquillon
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(TableFieldValue o)Compares thisTableFieldValuewith the specified one.booleanequals(Object o)static TableFieldValuefromString(String value, int sqlType)Constructs aTableFieldValueinstance from the specified value represented as aStringobject and according to the specified SQL type (a value amongTypes).TableFieldValuegetCopy()intgetType()Gets the code of the SQL type of this value.inthashCode()booleanisEmpty()Is this value an empty text?booleanisText()Is this value a text?StringtoString()voidupdate(String value)Updates this value with the textual representation of the new value.
-
-
-
Method Detail
-
fromString
public static TableFieldValue fromString(String value, int sqlType)
Constructs aTableFieldValueinstance from the specified value represented as aStringobject and according to the specified SQL type (a value amongTypes). If the specified value doesn't match the SQL type of this field value, then anIllegalArgumentExceptionexception is thrown.- Parameters:
value- theStringrepresentation of a value. Null value shouldn't be null but the String "null".sqlType- the SQL type as defined inTypes.- Returns:
- a
TableFieldValueinstance.
-
getType
public int getType()
Gets the code of the SQL type of this value.- Returns:
- the SQL type of this value as defined in
Types. - See Also:
for the available possible codes.
-
isText
public boolean isText()
Is this value a text?- Returns:
- true if the type of this value is a text, false otherwise.
-
isEmpty
public boolean isEmpty()
Is this value an empty text?- Returns:
- true if this value is a text and it is empty. False otherwise.
-
update
public void update(String value)
Updates this value with the textual representation of the new value. If the specified value doesn't match the SQL type of this field value, then anIllegalArgumentExceptionexception is thrown.- Parameters:
value- aStringrepresentation of the value. Null value shouldn't be null but the String "null".
-
compareTo
public int compareTo(TableFieldValue o)
Compares thisTableFieldValuewith the specified one. The comparing is actually done on the wrapped values themselves. If the wrapped values satisfy theComparableinterface then theComparable.compareTo(Object)method is used, otherwise both of them are converted inStringobjects and theseStringinstances are then compared between themselves.- Specified by:
compareToin interfaceComparable<TableFieldValue>- Parameters:
o- anotherTableFieldValuewith which this one is compared.- Returns:
- the comparing distance between the two
TableFieldValueinstances.
-
getCopy
public TableFieldValue getCopy()
-
-