- java.lang.Object
-
- org.tentackle.sql.datatypes.AbstractDataType<org.tentackle.common.BMoney>
-
- org.tentackle.sql.datatypes.BMoneyType
-
- All Implemented Interfaces:
DataType<org.tentackle.common.BMoney>
@Service(DataType.class) public class BMoneyType extends AbstractDataType<org.tentackle.common.BMoney>
Datatype forBMoney.
-
-
Constructor Summary
Constructors Constructor Description BMoneyType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.tentackle.common.BMoneyget(Backend backend, java.sql.ResultSet resultSet, int[] pos, boolean mapNull, java.lang.Integer size)Gets the object from a result set.
Must be implemented ifDataType.isPredefined()returns false.intgetColumnCount()Gets the number of database columns.
A tentackle type may be mapped to more than one column for multi-column types such asBMoney.java.lang.StringgetColumnGetter(int index)Gets the java getter name of a column.java.lang.ObjectgetColumnValue(int index, org.tentackle.common.BMoney value)Gets the value of a column.java.lang.StringgetJavaType()Gets the name of the Java type.intgetScale(int index, java.lang.Integer scale)Gets the column scale.intgetSize(int index, java.lang.Integer size)Gets the column size.SqlTypegetSqlType(int index)Gets the SQL type.booleanisNumeric()Returns whether this is a numeric type.java.lang.Object[]set(Backend backend, java.sql.PreparedStatement statement, int pos, org.tentackle.common.BMoney object, boolean mapNull, java.lang.Integer size)Sets the object into a prepared statement.
Must be implemented ifDataType.isPredefined()returns false.java.lang.Objectset(Backend backend, java.sql.PreparedStatement statement, int pos, org.tentackle.common.BMoney object, int index, boolean mapNull, java.lang.Integer size)Sets a column of an object into a prepared statement.
Must be implemented ifDataType.isPredefined()returns false.org.tentackle.common.BMoneyvalueOf(java.lang.String str)Parses a string and converts to the value of this type.
The method is used to parse a literal (for example the default value defined in the model).-
Methods inherited from class org.tentackle.sql.datatypes.AbstractDataType
equals, getColumnSuffix, getCommentSuffix, getDataTypeConstant, getVariant, hashCode, isBool, isDateOrTime, isDowncastNecessary, isJavaTypeGenerified, isLiteralSupported, isMapNullSupported, isModelProvidingInnerType, isMutable, isPredefined, isPrimitive, isUTCSupported, toLiteral, toNonPrimitive, toPrimitive, toString, toString, valueOfLiteralToCode
-
-
-
-
Method Detail
-
getJavaType
public java.lang.String getJavaType()
Description copied from interface:DataTypeGets the name of the Java type.- Returns:
- the type
-
isNumeric
public boolean isNumeric()
Description copied from interface:DataTypeReturns whether this is a numeric type.- Specified by:
isNumericin interfaceDataType<org.tentackle.common.BMoney>- Overrides:
isNumericin classAbstractDataType<org.tentackle.common.BMoney>- Returns:
- true if numeric
-
getColumnCount
public int getColumnCount()
Description copied from interface:DataTypeGets the number of database columns.
A tentackle type may be mapped to more than one column for multi-column types such asBMoney.- Specified by:
getColumnCountin interfaceDataType<org.tentackle.common.BMoney>- Overrides:
getColumnCountin classAbstractDataType<org.tentackle.common.BMoney>- Returns:
- default is 1
-
getSqlType
public SqlType getSqlType(int index)
Description copied from interface:DataTypeGets the SQL type.- Parameters:
index- the column index- Returns:
- the SQL type
-
getSize
public int getSize(int index, java.lang.Integer size)Description copied from interface:DataTypeGets the column size.- Specified by:
getSizein interfaceDataType<org.tentackle.common.BMoney>- Overrides:
getSizein classAbstractDataType<org.tentackle.common.BMoney>- Parameters:
index- the column indexsize- the size from the model- Returns:
- the column size
-
getScale
public int getScale(int index, java.lang.Integer scale)Description copied from interface:DataTypeGets the column scale.- Specified by:
getScalein interfaceDataType<org.tentackle.common.BMoney>- Overrides:
getScalein classAbstractDataType<org.tentackle.common.BMoney>- Parameters:
index- the column indexscale- the scale from the model- Returns:
- the column scale
-
getColumnValue
public java.lang.Object getColumnValue(int index, org.tentackle.common.BMoney value)Description copied from interface:DataTypeGets the value of a column.- Specified by:
getColumnValuein interfaceDataType<org.tentackle.common.BMoney>- Overrides:
getColumnValuein classAbstractDataType<org.tentackle.common.BMoney>- Parameters:
index- the column indexvalue- the datatype's value according to the model- Returns:
- the column's value
-
getColumnGetter
public java.lang.String getColumnGetter(int index)
Description copied from interface:DataTypeGets the java getter name of a column.- Specified by:
getColumnGetterin interfaceDataType<org.tentackle.common.BMoney>- Overrides:
getColumnGetterin classAbstractDataType<org.tentackle.common.BMoney>- Parameters:
index- the datatype's value according to the model- Returns:
- the column's getter name, empty string if this is a single column type
-
valueOf
public org.tentackle.common.BMoney valueOf(java.lang.String str)
Description copied from interface:DataTypeParses a string and converts to the value of this type.
The method is used to parse a literal (for example the default value defined in the model).Notice: the method doesn't use any locale, so the results are always the same regardless of the JVM's locale.
- Parameters:
str- the source string- Returns:
- the value
-
set
public java.lang.Object[] set(Backend backend, java.sql.PreparedStatement statement, int pos, org.tentackle.common.BMoney object, boolean mapNull, java.lang.Integer size) throws java.sql.SQLException
Description copied from interface:DataTypeSets the object into a prepared statement.
Must be implemented ifDataType.isPredefined()returns false. Not invoked by framework otherwise.- Parameters:
backend- the database backendstatement- the prepared statementpos- the position of the first SQL valueobject- the object, may be nullmapNull- true if map null-values to non-null valuessize- the optional size specified in the model- Returns:
- the values stored in the prepared statement
- Throws:
java.sql.SQLException- if failed
-
set
public java.lang.Object set(Backend backend, java.sql.PreparedStatement statement, int pos, org.tentackle.common.BMoney object, int index, boolean mapNull, java.lang.Integer size) throws java.sql.SQLException
Description copied from interface:DataTypeSets a column of an object into a prepared statement.
Must be implemented ifDataType.isPredefined()returns false. Not invoked by framework otherwise.- Specified by:
setin interfaceDataType<org.tentackle.common.BMoney>- Overrides:
setin classAbstractDataType<org.tentackle.common.BMoney>- Parameters:
backend- the database backendstatement- the prepared statementpos- the position of the first SQL valueobject- the object, may be nullindex- the column indexmapNull- true if map null-values to non-null valuessize- the optional size specified in the model- Returns:
- the object stored in the prepared statement
- Throws:
java.sql.SQLException- if failed
-
get
public org.tentackle.common.BMoney get(Backend backend, java.sql.ResultSet resultSet, int[] pos, boolean mapNull, java.lang.Integer size) throws java.sql.SQLException
Description copied from interface:DataTypeGets the object from a result set.
Must be implemented ifDataType.isPredefined()returns false. Not invoked by framework otherwise.- Parameters:
backend- the database backendresultSet- the result setpos- the column positions in the result setmapNull- true if unmap null-values from non-null valuessize- the optional size specified in the model- Returns:
- the object or null if column(s) IS NULL
- Throws:
java.sql.SQLException- if failed
-
-