修复target错误

This commit is contained in:
zhouhao
2018-07-02 18:04:52 +08:00
parent fcf46f0811
commit a0ef2f2e9b
2 changed files with 9 additions and 4 deletions

View File

@@ -137,7 +137,7 @@ public final class FastBeanCopier {
public static Copier createCopier(Class source, Class target) {
String sourceName = source.getName();
String tartName = source.getName();
String tartName = target.getName();
if (sourceName.startsWith("package ")) {
sourceName = sourceName.substring("package ".length());
}

View File

@@ -15,6 +15,7 @@ import org.springframework.util.ClassUtils;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
/**
* @author zhouhao
@@ -44,7 +45,6 @@ public class Proxy<I> {
throw new NullPointerException("superClass can not be null");
}
this.superClass = superClass;
ClassPool classPool = new ClassPool(true);
ClassPath classPath = new ClassClassPath(this.getClass());
@@ -85,7 +85,7 @@ public class Proxy<I> {
}
@SuppressWarnings("all")
protected MemberValue createMemberValue(Object value, ConstPool constPool) {
public static MemberValue createMemberValue(Object value, ConstPool constPool) {
MemberValue memberValue = null;
if (value instanceof Integer) {
memberValue = new IntegerMemberValue(constPool, ((Integer) value));
@@ -103,12 +103,17 @@ public class Proxy<I> {
arrayMemberValue.setValue(Arrays.stream(arr)
.map(o -> createMemberValue(o, constPool))
.toArray(MemberValue[]::new));
memberValue=arrayMemberValue;
memberValue = arrayMemberValue;
}
return memberValue;
}
public Proxy<I> custom(Consumer<CtClass> ctClassConsumer) {
ctClassConsumer.accept(ctClass);
return this;
}
@SneakyThrows
public Proxy<I> addField(String code, Class<? extends java.lang.annotation.Annotation> annotation, Map<String, Object> annotationProperties) {
return handleException(() -> {