public class BeanProcessor extends Object
SQLManagerBuilder.setBeanProcessor(BeanProcessor)
一些复杂的处理类也可以使用此类作为基础,比如JsonConfigMapper| 限定符和类型 | 类和说明 |
|---|---|
static interface |
BeanProcessor.AcceptType |
static class |
BeanProcessor.EnumAcceptType |
static class |
BeanProcessor.EnumTypeHandler
处理枚举类
|
static class |
BeanProcessor.InheritedAcceptType |
static class |
BeanProcessor.TemporalAcceptType
如果jdbc取值支持Temporal,
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected JavaSqlTypeHandler |
defaultHandler |
protected Map<Class,JavaSqlTypeHandler> |
handlers |
protected static int |
PROPERTY_IGNORE |
protected static int |
PROPERTY_NOT_FOUND |
| 构造器和说明 |
|---|
BeanProcessor() |
protected static final int PROPERTY_NOT_FOUND
protected static final int PROPERTY_IGNORE
protected Map<Class,JavaSqlTypeHandler> handlers
protected JavaSqlTypeHandler defaultHandler
public <T> List<T> mappingSelect(ExecuteContext ctx, ResultSet rs, Class<T> clazz) throws SQLException
T - ctx - rs - clazz - SQLExceptionpublic <T> T toBean(ExecuteContext ctx, ResultSet rs, Class<T> type) throws SQLException
rs - type - SQLExceptionpublic <T> List<T> toBeanList(ExecuteContext ctx, ResultSet rs, Class<T> type) throws SQLException
rs - type - SQLExceptionpublic Map<String,Object> toMap(ExecuteContext ctx, Class<?> c, ResultSet rs) throws SQLException
ctx - 上下文c - 一个Map子类rs - SQLExceptionpublic Object toBaseType(ExecuteContext ctx, Class<?> c, ResultSet rs) throws SQLException
SQLExceptionprotected <T> T createBean(ExecuteContext ctx, ResultSet rs, Class<T> type, PropertyDescriptor[] props, int[] columnToProperty) throws SQLException
rs - type - props - columnToProperty - SQLExceptionprotected Object noMappingValue(ReadTypeParameter tp) throws SQLException
SQLExceptionpublic void callSetter(Object target, PropertyDescriptor prop, Object value, Class<?> type) throws SQLException
target - 目标Beanprop - value - 值type - 值类型SQLExceptionprotected <T> T newInstance(Class<T> c) throws SQLException
c - SQLExceptionprotected int[] mapColumnsToProperties(ExecuteContext ctx, Class<?> c, ResultSetMetaData rsmd, PropertyDescriptor[] props) throws SQLException
c - rsmd - props - SQLExceptionprotected String getColName(ExecuteContext ctx, ResultSetMetaData rsmd, int col) throws SQLException
SQLExceptionpublic void setPreparedStatementPara(ExecuteContext ctx, PreparedStatement ps, List<SQLParameter> objs) throws SQLException
ctx - ps - objs - SQLExceptionpublic JavaSqlTypeHandler getDefaultHandler()
public void setDefaultHandler(JavaSqlTypeHandler defaultHandler)
public Map<Class,JavaSqlTypeHandler> getHandlers()
public void addHandler(Class target, JavaSqlTypeHandler handler)
public void addAcceptType(BeanProcessor.AcceptType acceptType)
public JavaSqlTypeHandler getHandler(Class target)
target - Copyright © 2021. All rights reserved.