public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource
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,
BeanWrapperTYPE_UNKNOWN| Constructor and Description |
|---|
BeanPropertySqlParameterSource(java.lang.Object object)
Create a new BeanPropertySqlParameterSource for the given bean.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
getTypeName, registerSqlType, registerTypeNamepublic BeanPropertySqlParameterSource(java.lang.Object object)
object - the bean instance to wrappublic boolean hasValue(java.lang.String paramName)
SqlParameterSourceparamName - the name of the parameterpublic java.lang.Object getValue(java.lang.String paramName)
throws java.lang.IllegalArgumentException
SqlParameterSourceparamName - the name of the parameterjava.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 SqlParameterSourcegetSqlType in class AbstractSqlParameterSourceparamName - the name of the parameterTYPE_UNKNOWN if not registeredStatementCreatorUtils.javaTypeToSqlParameterType(java.lang.Class)