Constructor and Description |
---|
GenericMapping(Platform platform) |
Modifier and Type | Method and Description |
---|---|
void |
addConverter(Converter<?,?> converter,
Class<?>... classes) |
FieldType |
mapAttribute(Attribute<?,?> attribute)
Get the mapped storage type mapping for a given type
Attribute . |
<T> Mapping |
putType(Class<? super T> type,
FieldType<T> fieldType)
Map a specific java class type to a
FieldType instance. |
<A> A |
read(Expression<A> expression,
ResultSet results,
int column)
Given the expression read it from
ResultSet instance. |
boolean |
readBoolean(ResultSet results,
int column)
Reads a boolean value.
|
byte |
readByte(ResultSet results,
int column)
Reads a byte value.
|
double |
readDouble(ResultSet results,
int column)
Reads a double value.
|
float |
readFloat(ResultSet results,
int column)
Reads a float value.
|
int |
readInt(ResultSet results,
int column)
Reads a integer value.
|
long |
readLong(ResultSet results,
int column)
Reads a long value.
|
short |
readShort(ResultSet results,
int column)
Reads a boolean value.
|
<T> Mapping |
replaceType(int sqlType,
FieldType<T> replacementType)
|
Class<?> |
typeOf(int sqlType)
Get the mapped storage type mapping for a given sql type.
|
<A> void |
write(Expression<A> expression,
PreparedStatement statement,
int index,
A value)
Given the expression bind it into a JDBC
PreparedStatement . |
void |
writeBoolean(PreparedStatement statement,
int index,
boolean value)
Sets a boolean value
|
void |
writeByte(PreparedStatement statement,
int index,
byte value)
Sets a byte value
|
void |
writeDouble(PreparedStatement statement,
int index,
double value)
Sets a double value
|
void |
writeFloat(PreparedStatement statement,
int index,
float value)
Sets a float value
|
void |
writeInt(PreparedStatement statement,
int index,
int value)
Sets a int value
|
void |
writeLong(PreparedStatement statement,
int index,
long value)
Sets a long value
|
void |
writeShort(PreparedStatement statement,
int index,
short value)
Sets a short value
|
public GenericMapping(Platform platform)
public <T> Mapping replaceType(int sqlType, FieldType<T> replacementType)
Mapping
FieldType
to a another FieldType
. If the
basic type is not mapped then a mapping will be added.replaceType
in interface Mapping
T
- the mapped typesqlType
- Types
to replacereplacementType
- non null replacement typepublic <T> Mapping putType(Class<? super T> type, FieldType<T> fieldType)
Mapping
FieldType
instance.public FieldType mapAttribute(Attribute<?,?> attribute)
Mapping
Attribute
.mapAttribute
in interface Mapping
attribute
- attribute non null attributeFieldType
public Class<?> typeOf(int sqlType)
Mapping
public <A> A read(Expression<A> expression, ResultSet results, int column) throws SQLException
Mapping
ResultSet
instance.read
in interface Mapping
A
- type to readexpression
- expression to readresults
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public boolean readBoolean(ResultSet results, int column) throws SQLException
Mapping
readBoolean
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public byte readByte(ResultSet results, int column) throws SQLException
Mapping
readByte
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public short readShort(ResultSet results, int column) throws SQLException
Mapping
readShort
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public int readInt(ResultSet results, int column) throws SQLException
Mapping
readInt
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public long readLong(ResultSet results, int column) throws SQLException
Mapping
readLong
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public float readFloat(ResultSet results, int column) throws SQLException
Mapping
readFloat
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public double readDouble(ResultSet results, int column) throws SQLException
Mapping
readDouble
in interface Mapping
results
- ResultSet
instancecolumn
- column indexSQLException
- on a failure to read from the ResultSet
public <A> void write(Expression<A> expression, PreparedStatement statement, int index, A value) throws SQLException
Mapping
PreparedStatement
.write
in interface Mapping
A
- type to be boundexpression
- to bindstatement
- prepared statement instanceindex
- statement indexvalue
- valueSQLException
- on a failure to set the expression on the PreparedStatement
public void writeBoolean(PreparedStatement statement, int index, boolean value) throws SQLException
Mapping
writeBoolean
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement
public void writeByte(PreparedStatement statement, int index, byte value) throws SQLException
Mapping
writeByte
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement
public void writeShort(PreparedStatement statement, int index, short value) throws SQLException
Mapping
writeShort
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement
public void writeInt(PreparedStatement statement, int index, int value) throws SQLException
Mapping
writeInt
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement
public void writeLong(PreparedStatement statement, int index, long value) throws SQLException
Mapping
writeLong
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement
public void writeFloat(PreparedStatement statement, int index, float value) throws SQLException
Mapping
writeFloat
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement
public void writeDouble(PreparedStatement statement, int index, double value) throws SQLException
Mapping
writeDouble
in interface Mapping
statement
- prepared statementindex
- statement indexvalue
- type to be boundSQLException
- on a failure to set the expression on the PreparedStatement