Reproduce优化

This commit is contained in:
redkale
2023-08-04 16:41:10 +08:00
parent 0fb3684a18
commit be11b0767e
4 changed files with 161 additions and 42 deletions

View File

@@ -0,0 +1,41 @@
/*
*
*/
package org.redkale.test.util;
import java.util.*;
import org.junit.jupiter.api.Test;
import org.redkale.util.*;
/**
*
* @author zhangjx
*/
public class ReproduceTest {
public static void main(String[] args) throws Throwable {
ReproduceTest test = new ReproduceTest();
test.run1();
test.run2();
}
@Test
public void run1() throws Exception {
TestBean bean = new TestBean();
bean.setId(222);
bean.time = 55555L;
bean.setName("haha");
bean.setMap(Utility.ofMap("aa", "bbb"));
System.out.println(Reproduce.copy(Map.class, bean));
}
@Test
public void run2() throws Exception {
TestBean bean = new TestBean();
bean.setId(222);
bean.time = 55555L;
bean.setName("haha");
bean.setMap(Utility.ofMap("aa", "bbb"));
System.out.println(Reproduce.load(Map.class, TestInterface.class).apply(new HashMap(), bean));
}
}

View File

@@ -11,7 +11,7 @@ import java.util.Map;
*
* @author zhangjx
*/
public class TestBean extends TestABean {
public class TestBean extends TestABean implements TestInterface {
private String name;

View File

@@ -0,0 +1,21 @@
/*
*
*/
package org.redkale.test.util;
import java.util.Map;
/**
*
* @author zhangjx
*/
public interface TestInterface {
public int getId();
public Map<String, String> getMap();
public void setId(int id);
public void setMap(Map<String, String> map);
}