v1.0.0 prepare

This commit is contained in:
开源海哥 2023-03-12 14:45:47 +08:00
parent 6964025451
commit 067d137be9
4 changed files with 9 additions and 44 deletions

View File

@ -18,6 +18,7 @@ package com.mybatisflex.core.table;
import org.apache.ibatis.reflection.ReflectorFactory; import org.apache.ibatis.reflection.ReflectorFactory;
public abstract class BaseReflectorFactory implements ReflectorFactory { public abstract class BaseReflectorFactory implements ReflectorFactory {
@Override @Override
public boolean isClassCacheEnabled() { public boolean isClassCacheEnabled() {
return true; return true;

View File

@ -23,14 +23,14 @@ public class IdInfo extends ColumnInfo {
/** /**
* id 生成策略 * id 生成策略
*/ */
private KeyType keyType = KeyType.None; private KeyType keyType;
/** /**
* keyType 类型是 sequence value 则代表的是 * 1 keyType 类型是 sequence value 则代表的是
* sequence 序列的 sql 内容 * sequence 序列的 sql 内容
* 例如select SEQ_USER_ID.nextval as id from dual * 例如select SEQ_USER_ID.nextval as id from dual
* * <p>
* keyType Generatorvalue 则代表的是使用的那个 keyGenerator 的名称 * 2 keyType Generatorvalue 则代表的是使用的那个 keyGenerator 的名称
*/ */
private String value; private String value;

View File

@ -79,7 +79,6 @@ public class TableInfos {
return getEntityClass((Class<?>) type); return getEntityClass((Class<?>) type);
} }
} }
return null; return null;
} }

View File

@ -27,7 +27,6 @@ import java.util.List;
*/ */
public class ClassUtil { public class ClassUtil {
//proxy frameworks //proxy frameworks
private static final List<String> PROXY_CLASS_NAMES = Arrays.asList("net.sf.cglib.proxy.Factory" private static final List<String> PROXY_CLASS_NAMES = Arrays.asList("net.sf.cglib.proxy.Factory"
// cglib // cglib
@ -68,8 +67,8 @@ public class ClassUtil {
public static <T> T newInstance(Class<T> clazz) { public static <T> T newInstance(Class<T> clazz) {
try { try {
Constructor constructor = clazz.getDeclaredConstructor(); Constructor<T> constructor = clazz.getDeclaredConstructor();
return (T) constructor.newInstance(); return constructor.newInstance();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -87,8 +86,7 @@ public class ClassUtil {
return (T) ret; return (T) ret;
} }
} }
throw new IllegalArgumentException("Can not find constructor by paras: \"" + Arrays.toString(paras) + "\" in class[" + clazz.getName()+"]");
throw new IllegalArgumentException("Can not matched constructor by paras" + Arrays.toString(paras) + " for class: " + clazz.getName());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -120,40 +118,6 @@ public class ClassUtil {
} }
public static String buildMethodString(Method method) {
StringBuilder sb = new StringBuilder()
.append(method.getDeclaringClass().getName())
.append(".")
.append(method.getName())
.append("(");
Class<?>[] params = method.getParameterTypes();
int in = 0;
for (Class<?> clazz : params) {
sb.append(clazz.getName());
if (++in < params.length) {
sb.append(",");
}
}
return sb.append(")").toString();
}
public static boolean hasClass(String className) {
try {
Class.forName(className, false, getClassLoader());
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
public static ClassLoader getClassLoader() {
ClassLoader ret = Thread.currentThread().getContextClassLoader();
return ret != null ? ret : ClassUtil.class.getClassLoader();
}
public static List<Field> getAllFields(Class<?> cl) { public static List<Field> getAllFields(Class<?> cl) {
List<Field> fields = new ArrayList<>(); List<Field> fields = new ArrayList<>();
@ -161,6 +125,7 @@ public class ClassUtil {
return fields; return fields;
} }
private static void doGetFields(Class<?> cl, List<Field> fields) { private static void doGetFields(Class<?> cl, List<Field> fields) {
if (cl == null || cl == Object.class) { if (cl == null || cl == Object.class) {
return; return;