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 int
compareTo(TableFieldValue o)
Compares thisTableFieldValue
with the specified one.boolean
equals(Object o)
static TableFieldValue
fromString(String value, int sqlType)
Constructs aTableFieldValue
instance from the specified value represented as aString
object and according to the specified SQL type (a value amongTypes
).TableFieldValue
getCopy()
int
getType()
Gets the code of the SQL type of this value.int
hashCode()
boolean
isEmpty()
Is this value an empty text?boolean
isText()
Is this value a text?String
toString()
void
update(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 aTableFieldValue
instance from the specified value represented as aString
object 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 anIllegalArgumentException
exception is thrown.- Parameters:
value
- theString
representation of a value. Null value shouldn't be null but the String "null".sqlType
- the SQL type as defined inTypes
.- Returns:
- a
TableFieldValue
instance.
-
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 anIllegalArgumentException
exception is thrown.- Parameters:
value
- aString
representation of the value. Null value shouldn't be null but the String "null".
-
compareTo
public int compareTo(TableFieldValue o)
Compares thisTableFieldValue
with the specified one. The comparing is actually done on the wrapped values themselves. If the wrapped values satisfy theComparable
interface then theComparable.compareTo(Object)
method is used, otherwise both of them are converted inString
objects and theseString
instances are then compared between themselves.- Specified by:
compareTo
in interfaceComparable<TableFieldValue>
- Parameters:
o
- anotherTableFieldValue
with which this one is compared.- Returns:
- the comparing distance between the two
TableFieldValue
instances.
-
getCopy
public TableFieldValue getCopy()
-
-