Class ResultColumn
- java.lang.Object
-
- com.feedzai.commons.sql.abstraction.dml.result.ResultColumn
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DB2ResultColumn,H2ResultColumn,MySqlResultColumn,OracleResultColumn,PostgreSqlResultColumn,SqlServerResultColumn
public abstract class ResultColumn extends Object implements Serializable
Abstract result column to be extended by specific implementations.- Since:
- 2.0.0
- Author:
- Rui Vilao (rui.vilao@feedzai.com)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResultColumn(String name, Object val)Creates a new instance ofResultColumn.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()booleanisNull()Checks if the value is null.protected ObjectprocessObject(Object o)Processes an object.<T> TtoBlob()Converts this result (in the form of blob) to the specified object type.BooleantoBoolean()DoubletoDouble()FloattoFloat()IntegertoInt()LongtoLong()ObjecttoObject()StringtoString()
-
-
-
Constructor Detail
-
ResultColumn
public ResultColumn(String name, Object val)
Creates a new instance ofResultColumn.- Parameters:
name- The column name.val- The column value.
-
-
Method Detail
-
processObject
protected Object processObject(Object o)
Processes an object. This method is to be overwritten by implementations that need to do some processing before theResultSetcloses.- Parameters:
o- The object in need of some kind of processing before being set.- Returns:
- The processed object.
- See Also:
DB2ResultColumn
-
isNull
public boolean isNull()
Checks if the value is null.- Returns:
- True if the value is null, false otherwise.
-
getName
public String getName()
- Returns:
- The name.
-
toString
public String toString()
-
toInt
public Integer toInt()
- Returns:
- This value in the form of an Integer.
-
toDouble
public Double toDouble()
- Returns:
- This value in the form of a Double.
-
toFloat
public Float toFloat()
- Returns:
- This value in the form of a Float.
-
toLong
public Long toLong()
- Returns:
- This value in the form of a Long.
-
toObject
public Object toObject()
- Returns:
- The object value.
-
toBoolean
public Boolean toBoolean()
- Returns:
- This value in the form of a Boolean.
-
toBlob
public <T> T toBlob() throws DatabaseEngineRuntimeExceptionConverts this result (in the form of blob) to the specified object type.- Type Parameters:
T- The type to convert.- Returns:
- The instance that was in the form of blob.
- Throws:
DatabaseEngineRuntimeException- If the value is not a blob or if something goes wrong when reading the object.
-
-