Reproduce优化
This commit is contained in:
41
src/test/java/org/redkale/test/util/ReproduceTest.java
Normal file
41
src/test/java/org/redkale/test/util/ReproduceTest.java
Normal 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));
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
21
src/test/java/org/redkale/test/util/TestInterface.java
Normal file
21
src/test/java/org/redkale/test/util/TestInterface.java
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user