public final class KeyGeneratorTypeHandlerInteger extends Object implements KeyGeneratorTypeHandler<Integer>
Constructor and Description |
---|
KeyGeneratorTypeHandlerInteger(boolean fail)
Construct an type handler for integer values.
|
KeyGeneratorTypeHandlerInteger(boolean fail,
int allocationSize) |
Modifier and Type | Method and Description |
---|---|
Integer |
add(Integer value,
int offset)
Adds the new Type Handler of type T to the provided handler instance at
the provided offset.
|
void |
bindValue(PreparedStatement stmt,
int index,
Integer value)
Binds the value in the sql preparedstatement at the provided index
location.
|
Integer |
getNextValue(ResultSet rs)
Gets the value from resultset by calling getValue method and then
calls the increment method to increment the extracted value.
|
Integer |
getValue(ResultSet rs)
Reads the resultset and return the extracted typehandler value from the
resultset.
|
Integer |
increment(Integer value)
Increments the provided value by ONE.
|
public KeyGeneratorTypeHandlerInteger(boolean fail)
fail
- true
if the type handler should fail when current row of the
record set is not valid, false
otherwise.public KeyGeneratorTypeHandlerInteger(boolean fail, int allocationSize)
public Integer getNextValue(ResultSet rs) throws PersistenceException, SQLException
getNextValue
in interface KeyGeneratorTypeHandler<Integer>
rs
- A ResultSet object.PersistenceException
- If ResultSet is empty or if the type handler
should fail when current row of the record set is not valid,SQLException
- If database error occurs.public Integer getValue(ResultSet rs) throws PersistenceException, SQLException
getValue
in interface KeyGeneratorTypeHandler<Integer>
rs
- ResultSet objectPersistenceException
- If ResultSet is empty or if the type handler
should fail when current row of the record set is not valid,SQLException
- If database error occurs.public Integer increment(Integer value)
increment
in interface KeyGeneratorTypeHandler<Integer>
value
- value to be incremented.public Integer add(Integer value, int offset)
add
in interface KeyGeneratorTypeHandler<Integer>
value
- Handler instance in which new value will be addedoffset
- Offset location. *public void bindValue(PreparedStatement stmt, int index, Integer value) throws SQLException
bindValue
in interface KeyGeneratorTypeHandler<Integer>
stmt
- A SQL PreparedStatement.index
- Index location for binding parameter to statement.value
- Value to be bindedSQLException
- If SQL error occurs in binding param to sql statement.Copyright © 2018. All rights reserved.