|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsf.qof.adapter.BooleanAdapter
public class BooleanAdapter
BooleanAdapter is a generator mapping adapter for boolean data types.
It maps VARCHAR
columns to boolean
and Boolean
and vice versa.
Examples:
(1) BooleanAdapter.register("yesno", "Y", "N", false, true); (2) BooleanAdapter.register("true-false", "true", "false", true, false); (3) BooleanAdapter.register("bigX", "X", null, true, true);
(1) Maps boolean types to "Y" and "N", is not case-sensitive ("y" is true as well)
and allows null values (a SQL null value gets mapped to false
if the
type is boolean
).
(2) Maps boolean types to the strings "true" and "false", is case-sensitive and does not allow null values.
(3) Maps boolean types to "X" and null, is case-sensitive and allows nulls.
registerYesNo()
,
register(String, String, String, boolean, boolean)
Method Summary | |
---|---|
void |
generateFromResult(ResultMapping resultMapping,
net.sf.cglib.core.CodeEmitter co,
net.sf.cglib.core.Local result,
int[] indexes)
Method to map the current record of a result set or the result of a callable statement to an object on the stack. |
void |
generateFromResultSet(ResultMapping resultMapping,
net.sf.cglib.core.CodeEmitter co,
net.sf.cglib.core.Local resultSet,
String[] columns)
Method to map the current record of a result set to an object on the stack. |
void |
generateRegisterOutputParameters(ResultMapping resultMapping,
net.sf.cglib.core.CodeEmitter co,
net.sf.cglib.core.Local callableStatement,
int[] indexes)
Method to register an output parameter in a callable statement. |
void |
generateToPreparedStatement(ParameterMapping parameterMapping,
net.sf.cglib.core.CodeEmitter co,
net.sf.cglib.core.Local preparedStatement,
int[] indexes,
net.sf.cglib.core.Local indexOffset)
Method to map the object on top of the stack to a prepared statement. |
int |
getNumberOfColumns()
Returns the number of mapped columns. |
Set<Class<?>> |
getTypes()
Returns the set of mappable Java types. |
static void |
register(String typeName,
String trueString,
String falseString,
boolean caseSensitive,
boolean allowNull)
Registers a BooleanAdapter with a given name. |
static void |
registerYesNo()
Registers a yes/no adapter with name "yesno". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void generateFromResult(ResultMapping resultMapping, net.sf.cglib.core.CodeEmitter co, net.sf.cglib.core.Local result, int[] indexes)
GeneratorMappingAdapter
indexes
defines the SQL indexes for the result set
to be used in functions such a getInt(index)
.
generateFromResult
in interface GeneratorMappingAdapter
resultMapping
- the result mappingco
- code emitterresult
- ResultSet
or CallableStatement
local variableindexes
- array of SQL indexespublic void generateFromResultSet(ResultMapping resultMapping, net.sf.cglib.core.CodeEmitter co, net.sf.cglib.core.Local resultSet, String[] columns)
GeneratorMappingAdapter
columns
defines the SQL column name for the result set to be used
in functions such a getInt(name)
.
generateFromResultSet
in interface GeneratorMappingAdapter
resultMapping
- the result mappingco
- code emitterresultSet
- ResultSet
local variablecolumns
- array of SQL column namespublic void generateToPreparedStatement(ParameterMapping parameterMapping, net.sf.cglib.core.CodeEmitter co, net.sf.cglib.core.Local preparedStatement, int[] indexes, net.sf.cglib.core.Local indexOffset)
GeneratorMappingAdapter
indexes
defines the SQL index for the prepared statement to be used
in functions such a setInt(index, value)
.
generateToPreparedStatement
in interface GeneratorMappingAdapter
parameterMapping
- the parameter mappingco
- code emitterpreparedStatement
- prepared statement local variableindexes
- array of SQL indexesindexOffset
- offset to be added to the indexes if not nullpublic void generateRegisterOutputParameters(ResultMapping resultMapping, net.sf.cglib.core.CodeEmitter co, net.sf.cglib.core.Local callableStatement, int[] indexes)
GeneratorMappingAdapter
generateRegisterOutputParameters
in interface GeneratorMappingAdapter
resultMapping
- the result mappingco
- code emittercallableStatement
- callable statement local variableindexes
- array of SQL indexespublic int getNumberOfColumns()
MappingAdapter
getNumberOfColumns
in interface MappingAdapter
public Set<Class<?>> getTypes()
MappingAdapter
getTypes
in interface MappingAdapter
public static void registerYesNo()
public static void register(String typeName, String trueString, String falseString, boolean caseSensitive, boolean allowNull)
BooleanAdapter
with a given name.
typeName
- the type name to be used in parameter and result definitionstrueString
- a string representing the true valuefalseString
- a string representing the false value. Can be nullcaseSensitive
- true if the mapping is case-sensitiveallowNull
- true if null values are allowed
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |