This commit is contained in:
wentch
2015-12-30 11:51:53 +08:00
parent ae48fdccdc
commit 287af65b33
3 changed files with 20 additions and 7 deletions

View File

@@ -31,7 +31,6 @@ public class BsonTestMain {
}
public static void main2(String[] args) throws Exception {
System.out.println(new String(new byte[]{109, 121, 110, 97, 109, 101}));
final BsonConvert convert = BsonFactory.root().getConvert();
SimpleChildEntity entry = SimpleChildEntity.create();
byte[] bytes = convert.convertTo(SimpleEntity.class, entry);

View File

@@ -5,6 +5,7 @@
*/
package org.redkale.test.convert;
import java.net.*;
import org.redkale.convert.ConvertEntity;
import java.util.*;
@@ -36,6 +37,7 @@ public class SimpleChildEntity extends SimpleEntity {
map.put("CCC", 333);
v.setMap(map);
v.setExtend("hahaha");
v.setAddr(new InetSocketAddress("127.0.0.1", 6666));
return v;
}

View File

@@ -5,6 +5,7 @@
*/
package org.redkale.test.convert;
import java.net.*;
import org.redkale.convert.json.JsonFactory;
import org.redkale.util.Creator;
import java.util.*;
@@ -29,6 +30,8 @@ public class SimpleEntity {
private Map<String, Integer> map;
private InetSocketAddress addr;
public static SimpleEntity create() {
SimpleEntity v = new SimpleEntity();
v.setName("this is name\n \"test");
@@ -45,6 +48,7 @@ public class SimpleEntity {
map.put("BBB", 222);
map.put("CCC", 333);
v.setMap(map);
v.setAddr(new InetSocketAddress("127.0.0.1", 6666));
return v;
}
@@ -66,6 +70,14 @@ public class SimpleEntity {
return JsonFactory.root().getConvert().convertTo(this);
}
public InetSocketAddress getAddr() {
return addr;
}
public void setAddr(InetSocketAddress addr) {
this.addr = addr;
}
public int[] getAddrs() {
return addrs;
}