This commit is contained in:
@@ -6,11 +6,11 @@
|
|||||||
package org.redkale.source;
|
package org.redkale.source;
|
||||||
|
|
||||||
import org.redkale.util.AutoLoad;
|
import org.redkale.util.AutoLoad;
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import static org.redkale.source.FilterExpress.*;
|
import static org.redkale.source.FilterExpress.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.*;
|
import java.util.function.*;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -77,7 +77,7 @@ public class FilterNodeTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean caridTransient() {
|
public static boolean caridTransient() {
|
||||||
@@ -178,7 +178,7 @@ public class FilterNodeTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ public class FilterNodeTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCartype() {
|
public int getCartype() {
|
||||||
@@ -271,7 +271,7 @@ public class FilterNodeTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserid() {
|
public int getUserid() {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.redkale.test.convert;
|
package org.redkale.test.convert;
|
||||||
|
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -16,6 +16,6 @@ public abstract class BasedEntity implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import org.redkale.convert.bson.BsonByteBufferWriter;
|
|||||||
import org.redkale.convert.bson.BsonFactory;
|
import org.redkale.convert.bson.BsonFactory;
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
import org.redkale.convert.bson.BsonConvert;
|
import org.redkale.convert.bson.BsonConvert;
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import java.nio.*;
|
import java.nio.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -59,10 +59,10 @@ public class BsonTestMain {
|
|||||||
SimpleChildEntity entry = SimpleChildEntity.create();
|
SimpleChildEntity entry = SimpleChildEntity.create();
|
||||||
byte[] bytes = convert.convertTo(SimpleEntity.class, entry);
|
byte[] bytes = convert.convertTo(SimpleEntity.class, entry);
|
||||||
Utility.println(null, bytes);
|
Utility.println(null, bytes);
|
||||||
System.out.println(JsonFactory.root().getConvert().convertTo(entry));
|
System.out.println(JsonConvert.root().convertTo(entry));
|
||||||
SimpleEntity rs = convert.convertFrom(SimpleEntity.class, bytes);
|
SimpleEntity rs = convert.convertFrom(SimpleEntity.class, bytes);
|
||||||
System.out.println(rs.toString());
|
System.out.println(rs.toString());
|
||||||
System.out.println(JsonFactory.root().getConvert().convertTo(rs));
|
System.out.println(JsonConvert.root().convertTo(rs));
|
||||||
|
|
||||||
ComplextEntity bean = new ComplextEntity();
|
ComplextEntity bean = new ComplextEntity();
|
||||||
byte[] bytes2 = convert.convertTo(Object.class, bean);
|
byte[] bytes2 = convert.convertTo(Object.class, bean);
|
||||||
@@ -80,7 +80,7 @@ public class BsonTestMain {
|
|||||||
convert.convertTo(out, SimpleEntity.class, entry);
|
convert.convertTo(out, SimpleEntity.class, entry);
|
||||||
byte[] bytes = out.toByteArray();
|
byte[] bytes = out.toByteArray();
|
||||||
Utility.println(null, bytes);
|
Utility.println(null, bytes);
|
||||||
System.out.println(JsonFactory.root().getConvert().convertTo(entry));
|
System.out.println(JsonConvert.root().convertTo(entry));
|
||||||
SimpleEntity rs = convert.convertFrom(SimpleEntity.class, new ByteArrayInputStream(bytes));
|
SimpleEntity rs = convert.convertFrom(SimpleEntity.class, new ByteArrayInputStream(bytes));
|
||||||
System.out.println(rs.toString());
|
System.out.println(rs.toString());
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ConstructorArgsEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
final JsonConvert jsonConvert = JsonFactory.root().getConvert();
|
final JsonConvert jsonConvert = JsonConvert.root();
|
||||||
final BsonConvert bsonConvert = BsonFactory.root().getConvert();
|
final BsonConvert bsonConvert = BsonFactory.root().getConvert();
|
||||||
ConstructorArgsEntity bean = new ConstructorArgsEntity(12345678, "哈哈");
|
ConstructorArgsEntity bean = new ConstructorArgsEntity(12345678, "哈哈");
|
||||||
bean.setCreatetime(System.currentTimeMillis());
|
bean.setCreatetime(System.currentTimeMillis());
|
||||||
@@ -62,6 +62,6 @@ public class ConstructorArgsEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.redkale.util.TypeToken;
|
|||||||
import org.redkale.convert.json.JsonFactory;
|
import org.redkale.convert.json.JsonFactory;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持泛型的
|
* 支持泛型的
|
||||||
@@ -35,10 +36,10 @@ public class GenericEntity<T, K, V> {
|
|||||||
bean.setEntry(new Entry<>("aaaa", SimpleEntity.create()));
|
bean.setEntry(new Entry<>("aaaa", SimpleEntity.create()));
|
||||||
final Type type = new TypeToken<GenericEntity<Long, String, SimpleEntity>>() {
|
final Type type = new TypeToken<GenericEntity<Long, String, SimpleEntity>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
JsonFactory.root().setTiny(true);
|
JsonFactory.root().tiny(true);
|
||||||
String json = JsonFactory.root().getConvert().convertTo(bean);
|
String json = JsonConvert.root().convertTo(bean);
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
System.out.println(JsonFactory.root().getConvert().convertFrom(type, json).toString());
|
System.out.println(JsonConvert.root().convertFrom(type, json).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,7 +87,7 @@ public class GenericEntity<T, K, V> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public K getKey() {
|
public K getKey() {
|
||||||
|
|||||||
@@ -101,12 +101,12 @@ public class InnerCoderEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
InnerCoderEntity record = InnerCoderEntity.create(200, "haha");
|
InnerCoderEntity record = InnerCoderEntity.create(200, "haha");
|
||||||
final JsonConvert convert = JsonFactory.root().getConvert();
|
final JsonConvert convert = JsonConvert.root();
|
||||||
String json = convert.convertTo(record);
|
String json = convert.convertTo(record);
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
System.out.println(convert.convertFrom(InnerCoderEntity.class, json).toString());
|
System.out.println(convert.convertFrom(InnerCoderEntity.class, json).toString());
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class JsonTestMain {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
JsonFactory factory = JsonFactory.root().tiny(true);
|
JsonFactory factory = JsonFactory.root().tiny(true);
|
||||||
final JsonConvert convert = JsonFactory.root().getConvert();
|
final JsonConvert convert = JsonConvert.root();
|
||||||
String json = "{\"access_token\":\"vVX2bIjN5P9TMOphDkStM96eNWapAehTuWAlVDO74aFaYxLwj2b-9-T9p_W2mfr9\",\"expires_in\":7200, \"aa\":\"\"}";
|
String json = "{\"access_token\":\"vVX2bIjN5P9TMOphDkStM96eNWapAehTuWAlVDO74aFaYxLwj2b-9-T9p_W2mfr9\",\"expires_in\":7200, \"aa\":\"\"}";
|
||||||
Map<String, String> map = convert.convertFrom(JsonConvert.TYPE_MAP_STRING_STRING, json);
|
Map<String, String> map = convert.convertFrom(JsonConvert.TYPE_MAP_STRING_STRING, json);
|
||||||
System.out.println(map);
|
System.out.println(map);
|
||||||
@@ -34,7 +34,7 @@ public class JsonTestMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main2(String[] args) throws Exception {
|
public static void main2(String[] args) throws Exception {
|
||||||
final JsonConvert convert = JsonFactory.root().getConvert();
|
final JsonConvert convert = JsonConvert.root();
|
||||||
SimpleChildEntity entry = SimpleChildEntity.create();
|
SimpleChildEntity entry = SimpleChildEntity.create();
|
||||||
String json = convert.convertTo(SimpleEntity.class, entry);
|
String json = convert.convertTo(SimpleEntity.class, entry);
|
||||||
System.out.println("长度: " + json.length());
|
System.out.println("长度: " + json.length());
|
||||||
@@ -58,7 +58,7 @@ public class JsonTestMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main3(String[] args) throws Exception {
|
public static void main3(String[] args) throws Exception {
|
||||||
final JsonConvert convert = JsonFactory.root().getConvert();
|
final JsonConvert convert = JsonConvert.root();
|
||||||
SimpleChildEntity entry = SimpleChildEntity.create();
|
SimpleChildEntity entry = SimpleChildEntity.create();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
convert.convertTo(out, SimpleEntity.class, entry);
|
convert.convertTo(out, SimpleEntity.class, entry);
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
package org.redkale.test.convert;
|
package org.redkale.test.convert;
|
||||||
|
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import org.redkale.util.Creator;
|
import org.redkale.util.Creator;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -53,7 +53,7 @@ public class SimpleEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.out.println(JsonFactory.root().getConvert().convertTo(create()));
|
System.out.println(JsonConvert.root().convertTo(create()));
|
||||||
Creator<SimpleEntity> creator = Creator.create(SimpleEntity.class); //Creator.create(10, SimpleEntity.class);
|
Creator<SimpleEntity> creator = Creator.create(SimpleEntity.class); //Creator.create(10, SimpleEntity.class);
|
||||||
SimpleEntity entry = creator.create();
|
SimpleEntity entry = creator.create();
|
||||||
System.out.println(entry);
|
System.out.println(entry);
|
||||||
@@ -67,7 +67,7 @@ public class SimpleEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InetSocketAddress getAddr() {
|
public InetSocketAddress getAddr() {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ package org.redkale.test.sncp;
|
|||||||
import org.redkale.convert.bson.BsonFactory;
|
import org.redkale.convert.bson.BsonFactory;
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
import org.redkale.source.FilterBean;
|
import org.redkale.source.FilterBean;
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -23,7 +23,7 @@ public class SncpTestBean implements FilterBean {
|
|||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
SncpTestBean bean = JsonFactory.root().getConvert().convertFrom(SncpTestBean.class, "{\"content\":\"数据: 01\",\"id\":1}");
|
SncpTestBean bean = JsonConvert.root().convertFrom(SncpTestBean.class, "{\"content\":\"数据: 01\",\"id\":1}");
|
||||||
System.out.println(bean);
|
System.out.println(bean);
|
||||||
byte[] bs = BsonFactory.root().getConvert().convertTo(bean);
|
byte[] bs = BsonFactory.root().getConvert().convertTo(bean);
|
||||||
Utility.println("---------", bs);
|
Utility.println("---------", bs);
|
||||||
@@ -32,7 +32,7 @@ public class SncpTestBean implements FilterBean {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.redkale.test.source;
|
package org.redkale.test.source;
|
||||||
|
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CREATE TABLE `LoginTestRecord` (
|
* CREATE TABLE `LoginTestRecord` (
|
||||||
@@ -41,7 +41,7 @@ public class LoginTestRecord {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSessionid() {
|
public String getSessionid() {
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import org.redkale.util.Sheet;
|
|||||||
import org.redkale.source.FilterBean;
|
import org.redkale.source.FilterBean;
|
||||||
import org.redkale.source.Flipper;
|
import org.redkale.source.Flipper;
|
||||||
import org.redkale.source.EntityInfo;
|
import org.redkale.source.EntityInfo;
|
||||||
import org.redkale.convert.json.JsonFactory;
|
|
||||||
import org.redkale.source.FilterNode;
|
import org.redkale.source.FilterNode;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -127,7 +127,7 @@ public class TestSourceCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ public class CreatorRecord {
|
|||||||
CreatorRecord record = Creator.create(CreatorRecord.class).create(new Object[]{null, "ss", null, true, null, (short) 45, null, 4.3f, null});
|
CreatorRecord record = Creator.create(CreatorRecord.class).create(new Object[]{null, "ss", null, true, null, (short) 45, null, 4.3f, null});
|
||||||
String json = record.toString();
|
String json = record.toString();
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
System.out.println(JsonFactory.root().getConvert().convertFrom(CreatorRecord.class, json).toString());
|
System.out.println(JsonConvert.root().convertFrom(CreatorRecord.class, json).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonFactory.root().getConvert().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
|||||||
Reference in New Issue
Block a user