|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.tom.sql.DefaultPrimitiveConverter
public class DefaultPrimitiveConverter
Implementations convert between PrimitiveValue
particles and SQL column values.
Field Summary | |
---|---|
protected BaseType |
bt
|
protected String |
column
|
protected PrimitiveType |
pt
|
Constructor Summary | |
---|---|
DefaultPrimitiveConverter(PrimitiveType pt,
String column)
|
|
DefaultPrimitiveConverter(PrimitiveType pt,
String column,
boolean isConcatenated)
|
Method Summary | |
---|---|
String |
getSelectSnippet(String tableAlias)
Returns an SQL fragment for SELECTing the particle value from the associated database table. |
String |
getSetSnippet(PrimitiveValue particle)
Returns a PreparedStatement fragment for setting the given particle value in an SQL statement. |
PrimitiveType |
getType()
Returns the primitive type that this converter converts. |
boolean |
isConcatenated()
|
void |
setParticle(PreparedStatement stmt,
PrimitiveValue particle,
int colIndex)
Converts the given particle and sets the designated SQL parameter in the given PreparedStatement . |
protected PrimitiveValue |
toBooleanParticle(Object sqlValue)
|
protected PrimitiveValue |
toDateParticle(Object sqlValue)
|
protected PrimitiveValue |
toDateTimeParticle(Object sqlValue)
|
protected PrimitiveValue |
toDecimalParticle(Object sqlValue)
|
protected PrimitiveValue |
toDoubleParticle(Object sqlValue)
|
protected PrimitiveValue |
toIntegerParticle(Object sqlValue)
|
PrimitiveValue |
toParticle(ResultSet rs,
int colIndex)
Builds a particle from the specified column of the current row of the given ResultSet . |
protected PrimitiveValue |
toStringParticle(Object sqlValue)
|
protected PrimitiveValue |
toTimeParticle(Object sqlValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final PrimitiveType pt
protected BaseType bt
protected final String column
Constructor Detail |
---|
public DefaultPrimitiveConverter(PrimitiveType pt, String column)
public DefaultPrimitiveConverter(PrimitiveType pt, String column, boolean isConcatenated)
Method Detail |
---|
public String getSelectSnippet(String tableAlias)
ParticleConverter
getSelectSnippet
in interface ParticleConverter<PrimitiveValue>
tableAlias
- alias that's used for disambiguating the table, may be null
X1.columname
), may be null
public String getSetSnippet(PrimitiveValue particle)
ParticleConverter
PreparedStatement
fragment for setting the given particle value in an SQL statement.
The value may be set in a literal SQL fashion (e.g. '2007-08-09') or as a PreparedStatement
placeholder
('?').
getSetSnippet
in interface ParticleConverter<PrimitiveValue>
particle
- particle value, can be null
- Returns:
- SQL fragment (e.g.
?
), may be null
public PrimitiveValue toParticle(ResultSet rs, int colIndex) throws SQLException
ParticleConverter
ResultSet
.
toParticle
in interface ParticleConverter<PrimitiveValue>
rs
- result set, never null
colIndex
- index of the column in the result set
null
SQLException
public PrimitiveType getType()
PrimitiveParticleConverter
getType
in interface PrimitiveParticleConverter
null
protected PrimitiveValue toBooleanParticle(Object sqlValue)
protected PrimitiveValue toDateParticle(Object sqlValue)
protected PrimitiveValue toDateTimeParticle(Object sqlValue)
protected PrimitiveValue toTimeParticle(Object sqlValue)
protected PrimitiveValue toDecimalParticle(Object sqlValue) throws NumberFormatException
NumberFormatException
protected PrimitiveValue toDoubleParticle(Object sqlValue) throws NumberFormatException
NumberFormatException
protected PrimitiveValue toIntegerParticle(Object sqlValue) throws NumberFormatException
NumberFormatException
protected PrimitiveValue toStringParticle(Object sqlValue)
public void setParticle(PreparedStatement stmt, PrimitiveValue particle, int colIndex) throws SQLException
ParticleConverter
PreparedStatement
.
setParticle
in interface ParticleConverter<PrimitiveValue>
stmt
- prepared statement, never null
particle
- particle value, can be nullcolIndex
- index of the SQL parameter in the statement
- Throws:
SQLException
public boolean isConcatenated()
isConcatenated
in interface PrimitiveParticleConverter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |