.
This commit is contained in:
@@ -11,6 +11,7 @@ import net.tccn.user.User;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -150,4 +151,22 @@ public class RunTest<T> {
|
||||
user.save();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t() {
|
||||
System.out.println(MetaKit.nextAlias());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kvTest() {
|
||||
Map map = new HashMap<>();
|
||||
|
||||
map.put("name", "xxxx");
|
||||
map.put("age", 12);
|
||||
map.put("abx", 123);
|
||||
|
||||
UserBean user = Kv.toBean(map, UserBean.class);
|
||||
|
||||
System.out.println(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import net.tccn.base.Kv;
|
||||
|
||||
/**
|
||||
* @author: liangxianyou at 2019/1/20 12:52.
|
||||
*/
|
||||
public class User {
|
||||
private int id;
|
||||
private String IP;
|
||||
private String platContact;
|
||||
private String idType;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIP() {
|
||||
return IP;
|
||||
}
|
||||
|
||||
public void setIP(String IP) {
|
||||
this.IP = IP;
|
||||
}
|
||||
|
||||
public String getPlatContact() {
|
||||
return platContact;
|
||||
}
|
||||
|
||||
public void setPlatContact(String platContact) {
|
||||
this.platContact = platContact;
|
||||
}
|
||||
|
||||
public String getIdType() {
|
||||
return idType;
|
||||
}
|
||||
|
||||
public void setIdType(String idType) {
|
||||
this.idType = idType;
|
||||
}
|
||||
|
||||
public String say(Kv kv) {
|
||||
String s = String.format("我叫:%s, 今年:%s岁", kv.get("name"), kv.get("age"));
|
||||
System.out.println(s);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"id=" + id +
|
||||
", IP='" + IP + '\'' +
|
||||
", platContact='" + platContact + '\'' +
|
||||
", idType='" + idType + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
29
src/test/java/UserBean.java
Normal file
29
src/test/java/UserBean.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import net.tccn.base.To;
|
||||
|
||||
/**
|
||||
* Created by liangxianyou at 2019/3/26 19:36.
|
||||
*/
|
||||
public class UserBean {
|
||||
|
||||
private String name;
|
||||
private int age;
|
||||
@To("abx")
|
||||
private float attr;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"name='" + name + '\'' +
|
||||
", age=" + age +
|
||||
", attr='" + attr + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user