Class TableFieldValue
java.lang.Object
org.silverpeas.components.mydb.model.TableFieldValue
- All Implemented Interfaces:
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
Modifier and TypeMethodDescriptionintCompares thisTableFieldValuewith the specified one.booleanstatic TableFieldValuefromString(String value, int sqlType) Constructs aTableFieldValueinstance from the specified value represented as aStringobject and according to the specified SQL type (a value amongTypes).getCopy()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?toString()voidUpdates this value with the textual representation of the new value.
-
Method Details
-
fromString
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:
-
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
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".
-
equals
-
hashCode
public int hashCode() -
compareTo
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.
-
toString
-
getCopy
-