public class BooleanYNTranslator extends java.lang.Object implements TypeTranslator<java.lang.Boolean>
TypeTranslator
that translates a boolean field using
PreparedStatement.setString(int, String)
and ResultSet.getString(int)
.
"Y" is used for true and "N" is used for false.Constructor and Description |
---|
BooleanYNTranslator() |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
read(java.sql.ResultSet resultSet,
int columnIndex)
Reads value from result set.
|
void |
write(java.sql.PreparedStatement preparedStatement,
int parameterIndex,
java.lang.Boolean parameter)
Sets parameter value in the prepared statement.
|
public void write(java.sql.PreparedStatement preparedStatement, int parameterIndex, java.lang.Boolean parameter) throws java.lang.Exception
write
in interface TypeTranslator<java.lang.Boolean>
preparedStatement
- set column value as parameter in this statementparameterIndex
- set parameter at this indexparameter
- value to set in prepared statementjava.lang.Exception
- if errorpublic java.lang.Boolean read(java.sql.ResultSet resultSet, int columnIndex) throws java.lang.Exception
read
in interface TypeTranslator<java.lang.Boolean>
resultSet
- read value from this result setcolumnIndex
- read value at this column index from result setjava.lang.Exception
- if error