|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource
public class BeanPropertySqlParameterSource
SqlParameterSource
implementation that obtains parameter values
from bean properties of a given JavaBean object. The names of the bean
properties have to match the parameter names.
Uses a Spring BeanWrapper for bean property access underneath.
NamedParameterJdbcTemplate
,
BeanWrapper
Field Summary | |
---|---|
private BeanWrapper |
beanWrapper
|
private java.lang.String[] |
propertyNames
|
Fields inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource |
---|
TYPE_UNKNOWN |
Constructor Summary | |
---|---|
BeanPropertySqlParameterSource(java.lang.Object object)
Create a new BeanPropertySqlParameterSource for the given bean. |
Method Summary | |
---|---|
java.lang.String[] |
getReadablePropertyNames()
Provide access to the property names of the wrapped bean. |
int |
getSqlType(java.lang.String paramName)
Derives a default SQL type from the corresponding property type. |
java.lang.Object |
getValue(java.lang.String paramName)
Return the parameter value for the requested named parameter. |
boolean |
hasValue(java.lang.String paramName)
Determine whether there is a value for the specified named parameter. |
Methods inherited from class org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource |
---|
getTypeName, registerSqlType, registerTypeName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final BeanWrapper beanWrapper
private java.lang.String[] propertyNames
Constructor Detail |
---|
public BeanPropertySqlParameterSource(java.lang.Object object)
object
- the bean instance to wrapMethod Detail |
---|
public boolean hasValue(java.lang.String paramName)
SqlParameterSource
paramName
- the name of the parameter
public java.lang.Object getValue(java.lang.String paramName) throws java.lang.IllegalArgumentException
SqlParameterSource
paramName
- the name of the parameter
java.lang.IllegalArgumentException
- if there is no value for the requested parameterpublic java.lang.String[] getReadablePropertyNames()
PropertyAccessor
interface.
public int getSqlType(java.lang.String paramName)
getSqlType
in interface SqlParameterSource
getSqlType
in class AbstractSqlParameterSource
paramName
- the name of the parameter
TYPE_UNKNOWN
if not registeredStatementCreatorUtils.javaTypeToSqlParameterType(java.lang.Class)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |