public class ReflectionUtil extends Object
| 构造器和说明 |
|---|
ReflectionUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Field[] |
getFields(Class _class)
获取类属性
|
static Field |
getId(Class _class)
获取id属性
|
static boolean |
hasId(Object instance)
对象是否存在id
|
static boolean |
hasUniqueKey(Class _class)
该类是否有唯一性约束
|
static <T> List<T> |
mappingResultToList(ResultSet resultSet,
List<T> instanceList,
Class<T> _class)
将ResultSet映射到List中
|
static <T> void |
mappingResultToList(ResultSet resultSet,
List<T> instanceList,
Class<T> _class,
String column)
将ResultSet映射到List中
|
static void |
setId(Object instance,
long value)
获取id属性
|
static String |
setValueWithInsertIgnore(PreparedStatement ps,
Object instance,
String sql)
直接插入
为prepareStatement赋值
返回实际执行的SQL语句
|
static String |
setValueWithUpdateById(PreparedStatement ps,
Object instance,
String sql)
根据id更新
为prepareStatement赋值
|
static String |
setValueWithUpdateByUniqueKey(PreparedStatement ps,
Object instance,
String sql)
根据UniqueKey更新
为prepareStatement赋值
|
public static Field getId(Class _class) throws NoSuchFieldException
public static void setId(Object instance, long value) throws NoSuchFieldException, IllegalAccessException
public static boolean hasUniqueKey(Class _class)
public static boolean hasId(Object instance) throws NoSuchFieldException, IllegalAccessException
public static String setValueWithInsertIgnore(PreparedStatement ps, Object instance, String sql) throws SQLException, IllegalAccessException
public static String setValueWithUpdateById(PreparedStatement ps, Object instance, String sql) throws SQLException, IllegalAccessException, NoSuchFieldException
public static String setValueWithUpdateByUniqueKey(PreparedStatement ps, Object instance, String sql) throws SQLException, IllegalAccessException
public static <T> void mappingResultToList(ResultSet resultSet, List<T> instanceList, Class<T> _class, String column) throws SQLException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException
public static <T> List<T> mappingResultToList(ResultSet resultSet, List<T> instanceList, Class<T> _class) throws SQLException, IllegalAccessException, InstantiationException
SQLExceptionIllegalAccessExceptionInstantiationExceptionCopyright © 2019. All rights reserved.