新增基础类,新增测试
parent
fb1b565f88
commit
cc1ac66838
24
pom.xml
24
pom.xml
|
@ -56,6 +56,12 @@
|
||||||
<version>0.7.1</version>
|
<version>0.7.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.esotericsoftware</groupId>
|
||||||
|
<artifactId>kryo</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjdk.jmh</groupId>
|
<groupId>org.openjdk.jmh</groupId>
|
||||||
<artifactId>jmh-core</artifactId>
|
<artifactId>jmh-core</artifactId>
|
||||||
|
@ -68,6 +74,24 @@
|
||||||
<version>1.37</version>
|
<version>1.37</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.25</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -90,6 +90,7 @@ public class JfireSEConfig
|
||||||
staticRegisterClass(ConcurrentSkipListSet.class);
|
staticRegisterClass(ConcurrentSkipListSet.class);
|
||||||
staticRegisterClass(Date.class);
|
staticRegisterClass(Date.class);
|
||||||
staticRegisterClass(java.sql.Date.class);
|
staticRegisterClass(java.sql.Date.class);
|
||||||
|
staticRegisterClass(Calendar.getInstance().getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
public JfireSEConfig refTracking()
|
public JfireSEConfig refTracking()
|
||||||
|
|
|
@ -23,18 +23,15 @@ public class JfireSEImpl implements JfireSE
|
||||||
* 用于存储逆序列化过程中的临时信息
|
* 用于存储逆序列化过程中的临时信息
|
||||||
*/
|
*/
|
||||||
private ClassInfo[] deSerializedClassInfos;
|
private ClassInfo[] deSerializedClassInfos;
|
||||||
private ByteArray byteArray = new ByteArray(1000);
|
private ByteArray byteArray = new ByteArray(1000);
|
||||||
private ClassInfo classInfoCache;
|
private ClassInfo classInfoCache;
|
||||||
private Map<Class<?>, ClassInfo> classInfoMap = new HashMap<>();
|
private Map<Class<?>, ClassInfo> classInfoMap = new HashMap<>();
|
||||||
private SerializerFactory serializerFactory = new SerializerFactory(this);
|
private SerializerFactory serializerFactory = new SerializerFactory(this);
|
||||||
private Map<byte[], ClassInfo> classInfoCacheMap = new HashMap<>();
|
private Map<byte[], ClassInfo> classInfoCacheMap = new HashMap<>();
|
||||||
|
private Map<byte[], Class<?>> classNameBytesCache = new HashMap<>();
|
||||||
|
|
||||||
public JfireSEImpl(boolean refTracking, StaticClasInfo[] staticClasInfos)
|
public JfireSEImpl(boolean refTracking, StaticClasInfo[] staticClasInfos)
|
||||||
{
|
{
|
||||||
for (StaticClasInfo each : staticClasInfos)
|
|
||||||
{
|
|
||||||
each.setSerializer(serializerFactory.getSerializer(each.getClazz()));
|
|
||||||
}
|
|
||||||
this.refTracking = refTracking;
|
this.refTracking = refTracking;
|
||||||
this.staticClassId = staticClasInfos.length - 1;
|
this.staticClassId = staticClasInfos.length - 1;
|
||||||
serializedClassInfos = new ClassInfo[staticClasInfos.length * 2];
|
serializedClassInfos = new ClassInfo[staticClasInfos.length * 2];
|
||||||
|
@ -42,6 +39,10 @@ public class JfireSEImpl implements JfireSE
|
||||||
System.arraycopy(staticClasInfos, 0, serializedClassInfos, 0, staticClasInfos.length);
|
System.arraycopy(staticClasInfos, 0, serializedClassInfos, 0, staticClasInfos.length);
|
||||||
System.arraycopy(staticClasInfos, 0, deSerializedClassInfos, 0, staticClasInfos.length);
|
System.arraycopy(staticClasInfos, 0, deSerializedClassInfos, 0, staticClasInfos.length);
|
||||||
dynamicClassId = staticClassId + 1;
|
dynamicClassId = staticClassId + 1;
|
||||||
|
for (StaticClasInfo each : staticClasInfos)
|
||||||
|
{
|
||||||
|
each.setSerializer(serializerFactory.getSerializer(each.getClazz()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,34 +142,36 @@ public class JfireSEImpl implements JfireSE
|
||||||
@Override
|
@Override
|
||||||
public ClassInfo find(byte[] classNameBytes, int classId)
|
public ClassInfo find(byte[] classNameBytes, int classId)
|
||||||
{
|
{
|
||||||
try
|
Class<?> clazz = classNameBytesCache.computeIfAbsent(classNameBytes, bytes -> {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Class.forName(new String(classNameBytes, StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ClassInfo classInfo = getOrCreateClassInfo(clazz);
|
||||||
|
if (deSerializedClassInfos == null)
|
||||||
{
|
{
|
||||||
Class<?> clazz = Class.forName(new String(classNameBytes, StandardCharsets.UTF_8));
|
deSerializedClassInfos = new ClassInfo[classId + 1];
|
||||||
ClassInfo classInfo = getOrCreateClassInfo(clazz);
|
deSerializedClassInfos[classId] = classInfo;
|
||||||
if (deSerializedClassInfos == null)
|
|
||||||
{
|
|
||||||
deSerializedClassInfos = new ClassInfo[classId + 1];
|
|
||||||
deSerializedClassInfos[classId] = classInfo;
|
|
||||||
}
|
|
||||||
else if (classId >= deSerializedClassInfos.length)
|
|
||||||
{
|
|
||||||
int newLen = deSerializedClassInfos.length * 2;
|
|
||||||
newLen = newLen > classId ? newLen : classId + 1;
|
|
||||||
ClassInfo[] tmp = new ClassInfo[newLen];
|
|
||||||
System.arraycopy(deSerializedClassInfos, 0, tmp, 0, deSerializedClassInfos.length);
|
|
||||||
deSerializedClassInfos = tmp;
|
|
||||||
deSerializedClassInfos[classId] = classInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
deSerializedClassInfos[classId] = classInfo;
|
|
||||||
}
|
|
||||||
return classInfo;
|
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
else if (classId >= deSerializedClassInfos.length)
|
||||||
{
|
{
|
||||||
throw new RuntimeException(e);
|
int newLen = deSerializedClassInfos.length * 2;
|
||||||
|
newLen = newLen > classId ? newLen : classId + 1;
|
||||||
|
ClassInfo[] tmp = new ClassInfo[newLen];
|
||||||
|
System.arraycopy(deSerializedClassInfos, 0, tmp, 0, deSerializedClassInfos.length);
|
||||||
|
deSerializedClassInfos = tmp;
|
||||||
|
deSerializedClassInfos[classId] = classInfo;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deSerializedClassInfos[classId] = classInfo;
|
||||||
|
}
|
||||||
|
return classInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class DynamicClassInfo extends ClassInfo
|
||||||
{
|
{
|
||||||
if (firstSerialized)
|
if (firstSerialized)
|
||||||
{
|
{
|
||||||
firstSerialized = true;
|
firstSerialized = false;
|
||||||
addTracking(instance);
|
addTracking(instance);
|
||||||
byteArray.put(JfireSE.NAME_ID_CONTENT_TRACK);
|
byteArray.put(JfireSE.NAME_ID_CONTENT_TRACK);
|
||||||
byteArray.writeBytesWithSizeEmbedded(classNameBytes);
|
byteArray.writeBytesWithSizeEmbedded(classNameBytes);
|
||||||
|
@ -63,7 +63,7 @@ public class DynamicClassInfo extends ClassInfo
|
||||||
{
|
{
|
||||||
if (firstSerialized)
|
if (firstSerialized)
|
||||||
{
|
{
|
||||||
firstSerialized = true;
|
firstSerialized = false;
|
||||||
byteArray.put(JfireSE.NAME_ID_CONTENT_UN_TRACK);
|
byteArray.put(JfireSE.NAME_ID_CONTENT_UN_TRACK);
|
||||||
byteArray.writeBytesWithSizeEmbedded(classNameBytes);
|
byteArray.writeBytesWithSizeEmbedded(classNameBytes);
|
||||||
byteArray.writePositiveVarInt(classId);
|
byteArray.writePositiveVarInt(classId);
|
||||||
|
|
|
@ -22,4 +22,9 @@ public interface Serializer
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Object read(ByteArray byteArray, RefTracking refTracking);
|
Object read(ByteArray byteArray, RefTracking refTracking);
|
||||||
|
|
||||||
|
default void init()
|
||||||
|
{
|
||||||
|
//为了 ObjectSerializer 和 ArraySerializer 需要初始化的类提供。
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@ package com.jfirer.se2.serializer;
|
||||||
import com.jfirer.se2.JfireSE;
|
import com.jfirer.se2.JfireSE;
|
||||||
import com.jfirer.se2.serializer.impl.*;
|
import com.jfirer.se2.serializer.impl.*;
|
||||||
import com.jfirer.se2.serializer.impl.ObjectSerializer.ObjectSerializer;
|
import com.jfirer.se2.serializer.impl.ObjectSerializer.ObjectSerializer;
|
||||||
|
import com.jfirer.se2.serializer.impl.jdk.*;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListSet;
|
import java.util.concurrent.ConcurrentSkipListSet;
|
||||||
|
@ -54,17 +56,34 @@ public class SerializerFactory
|
||||||
store.put(LinkedHashSet.class, new SetSerializer(LinkedHashSet.class, jfireSE));
|
store.put(LinkedHashSet.class, new SetSerializer(LinkedHashSet.class, jfireSE));
|
||||||
store.put(Date.class, new DateSerializer());
|
store.put(Date.class, new DateSerializer());
|
||||||
store.put(java.sql.Date.class, new SqlDateSerializer());
|
store.put(java.sql.Date.class, new SqlDateSerializer());
|
||||||
|
store.put(Calendar.getInstance().getClass(), new CalendarSerializer());
|
||||||
|
store.put(Method.class, new MethodSerializer());
|
||||||
|
store.put(Class.class, new ClassSerializer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Serializer getSerializer(Class<?> clazz)
|
public Serializer getSerializer(Class<?> clazz)
|
||||||
{
|
{
|
||||||
if (clazz.isArray())
|
Serializer match = store.get(clazz);
|
||||||
|
if (match != null)
|
||||||
{
|
{
|
||||||
return store.computeIfAbsent(clazz, key -> new ArraySerializer(key, jfireSE));
|
return match;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return store.computeIfAbsent(clazz, key -> ObjectSerializer.buildCompileVersion(key, jfireSE));
|
if (clazz.isArray())
|
||||||
|
{
|
||||||
|
ArraySerializer arraySerializer = new ArraySerializer(clazz, jfireSE);
|
||||||
|
store.putIfAbsent(clazz, arraySerializer);
|
||||||
|
arraySerializer.init();
|
||||||
|
return arraySerializer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Serializer serializer = ObjectSerializer.buildCompileVersion(clazz, jfireSE);
|
||||||
|
store.putIfAbsent(clazz, serializer);
|
||||||
|
serializer.init();
|
||||||
|
return serializer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,18 @@ import static com.jfirer.se2.JfireSE.*;
|
||||||
public class ArraySerializer implements Serializer
|
public class ArraySerializer implements Serializer
|
||||||
{
|
{
|
||||||
private final Class<?> componentType;
|
private final Class<?> componentType;
|
||||||
private final ClassInfo typeDefinedClassInfo;
|
private ClassInfo typeDefinedClassInfo;
|
||||||
private final JfireSE jfireSE;
|
private final JfireSE jfireSE;
|
||||||
|
|
||||||
public ArraySerializer(Class<?> clazz, JfireSE jfireSE)
|
public ArraySerializer(Class<?> clazz, JfireSE jfireSE)
|
||||||
{
|
{
|
||||||
this.jfireSE = jfireSE;
|
this.jfireSE = jfireSE;
|
||||||
this.componentType = clazz.getComponentType();
|
this.componentType = clazz.getComponentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
typeDefinedClassInfo = jfireSE.getOrCreateClassInfo(componentType);
|
typeDefinedClassInfo = jfireSE.getOrCreateClassInfo(componentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,8 @@ public abstract class FieldInfo
|
||||||
public abstract void write(ByteArray byteArray, Object instance);
|
public abstract void write(ByteArray byteArray, Object instance);
|
||||||
|
|
||||||
public abstract void read(ByteArray byteArray, Object instance);
|
public abstract void read(ByteArray byteArray, Object instance);
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,21 @@ import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class FinalFieldInfo extends FieldInfo
|
public class FinalFieldInfo extends FieldInfo
|
||||||
{
|
{
|
||||||
private ClassInfo classInfo;
|
private ClassInfo classInfo;
|
||||||
private JfireSE jfireSE;
|
private JfireSE jfireSE;
|
||||||
|
|
||||||
public FinalFieldInfo(Field field, JfireSE jfireSE)
|
public FinalFieldInfo(Field field, JfireSE jfireSE)
|
||||||
{
|
{
|
||||||
super(field);
|
super(field);
|
||||||
classInfo = jfireSE.getOrCreateClassInfo(field.getType());
|
|
||||||
this.jfireSE = jfireSE;
|
this.jfireSE = jfireSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
classInfo = jfireSE.getOrCreateClassInfo(field.getType());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteArray byteArray, Object instance)
|
public void write(ByteArray byteArray, Object instance)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,12 +28,21 @@ public class ObjectSerializer implements Serializer
|
||||||
private static int COMPILE_COUNT = 1;
|
private static int COMPILE_COUNT = 1;
|
||||||
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
|
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
|
||||||
|
|
||||||
public ObjectSerializer(Class<?> clazz, JfireSEImpl jfireSE)
|
private ObjectSerializer(Class<?> clazz, JfireSE jfireSE)
|
||||||
{
|
{
|
||||||
fieldInfos = parse(clazz, jfireSE).toArray(FieldInfo[]::new);
|
fieldInfos = parse(clazz, jfireSE).toArray(FieldInfo[]::new);
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
for (FieldInfo each : fieldInfos)
|
||||||
|
{
|
||||||
|
each.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeBytes(ByteArray byteArray, Object instance)
|
public void writeBytes(ByteArray byteArray, Object instance)
|
||||||
{
|
{
|
||||||
|
@ -67,45 +76,58 @@ public class ObjectSerializer implements Serializer
|
||||||
|
|
||||||
public static List<FieldInfo> parse(Class<?> clazz, JfireSE jfireSE)
|
public static List<FieldInfo> parse(Class<?> clazz, JfireSE jfireSE)
|
||||||
{
|
{
|
||||||
Class type = clazz;
|
Class type = clazz;
|
||||||
List<Field> fields = new ArrayList<>();
|
List<Field> fields = new ArrayList<>();
|
||||||
while (type != Object.class)
|
while (type != Object.class)
|
||||||
{
|
{
|
||||||
fields.addAll(Arrays.stream(type.getDeclaredFields()).filter(Predicate.not(field -> Modifier.isStatic(field.getModifiers()))).toList());
|
fields.addAll(Arrays.stream(type.getDeclaredFields()).filter(Predicate.not(field -> Modifier.isStatic(field.getModifiers())))//
|
||||||
|
.filter(field -> !Modifier.isTransient(field.getModifiers()))//
|
||||||
|
.toList());
|
||||||
type = type.getSuperclass();
|
type = type.getSuperclass();
|
||||||
}
|
}
|
||||||
List<PrimitiveFieldInfo> primitiveFieldInfos = fields.stream().filter(field -> field.getType().isPrimitive())//
|
List<PrimitiveFieldInfo> primitiveFieldInfos = new LinkedList<>();
|
||||||
.sorted(Comparator.comparing(o -> o.getType().getName()))//
|
List<BoxedFieldInfo> boxedFieldInfos = new LinkedList<>();
|
||||||
.map(PrimitiveFieldInfo::new)//
|
List<VariableFieldInfo> variableFieldInfos = new LinkedList<>();
|
||||||
.toList();
|
List<FinalFieldInfo> finalFieldInfos = new LinkedList<>();
|
||||||
List<BoxedFieldInfo> boxedFieldInfos = fields.stream().filter(field -> ReflectUtil.isPrimitiveBox(field.getType()) || field.getType() == String.class)//
|
List<UnknowObjectFieldInfo> unknowObjectFieldInfos = new LinkedList<>();
|
||||||
.sorted(Comparator.comparing(o -> o.getType().getName()))//
|
for (Field each : fields)
|
||||||
.map(BoxedFieldInfo::new)//
|
{
|
||||||
.toList();
|
if (each.getType().isPrimitive())
|
||||||
List<FinalFieldInfo> finalFieldInfos = fields.stream().filter(Predicate.not(field -> ReflectUtil.isPrimitiveBox(field.getType())))//
|
{
|
||||||
.filter(Predicate.not(field -> ReflectUtil.isPrimitive(field.getType())))//
|
primitiveFieldInfos.add(new PrimitiveFieldInfo(each));
|
||||||
.filter(field -> field.getType() != String.class)//
|
}
|
||||||
.filter(field -> field.getType() != void.class && field.getType() != Void.class)//
|
else if (ReflectUtil.isPrimitiveBox(each.getType()) || each.getType() == String.class)
|
||||||
.filter(field -> Modifier.isFinal(field.getType().getModifiers()))//
|
{
|
||||||
.sorted(Comparator.comparing(o -> o.getType().getName()))//
|
boxedFieldInfos.add(new BoxedFieldInfo(each));
|
||||||
.map(field -> new FinalFieldInfo(field, jfireSE))//
|
}
|
||||||
.toList();
|
else if (each.getType() == Object.class || each.getType().isInterface())
|
||||||
List<VariableFieldInfo> variableFieldInfos = fields.stream().filter(Predicate.not(field -> ReflectUtil.isPrimitiveBox(field.getType())))//
|
{
|
||||||
.filter(Predicate.not(field -> ReflectUtil.isPrimitive(field.getType())))//
|
unknowObjectFieldInfos.add(new UnknowObjectFieldInfo(each, jfireSE));
|
||||||
.filter(field -> field.getType() != String.class)//
|
}
|
||||||
.filter(field -> field.getType() != void.class && field.getType() != Void.class)//
|
else if (Modifier.isFinal(each.getType().getModifiers()))
|
||||||
.filter(field -> !Modifier.isFinal(field.getType().getModifiers()))//
|
{
|
||||||
.sorted(Comparator.comparing(o -> o.getType().getName()))//
|
finalFieldInfos.add(new FinalFieldInfo(each, jfireSE));
|
||||||
.map(field -> new VariableFieldInfo(field, jfireSE))//
|
}
|
||||||
.toList();
|
else
|
||||||
|
{
|
||||||
|
variableFieldInfos.add(new VariableFieldInfo(each, jfireSE));
|
||||||
|
}
|
||||||
|
}
|
||||||
List<FieldInfo> list = new LinkedList<>();
|
List<FieldInfo> list = new LinkedList<>();
|
||||||
list.addAll(primitiveFieldInfos);
|
list.addAll(primitiveFieldInfos);
|
||||||
list.addAll(boxedFieldInfos);
|
list.addAll(boxedFieldInfos);
|
||||||
list.addAll(finalFieldInfos);
|
list.addAll(finalFieldInfos);
|
||||||
list.addAll(variableFieldInfos);
|
list.addAll(variableFieldInfos);
|
||||||
|
list.addAll(unknowObjectFieldInfos);
|
||||||
|
list.sort(Comparator.comparing(o -> o.getField().getType().getName()));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Serializer buildSlowVersion(Class<?> clazz, JfireSE jfireSE)
|
||||||
|
{
|
||||||
|
return new ObjectSerializer(clazz, jfireSE);
|
||||||
|
}
|
||||||
|
|
||||||
public static Serializer buildCompileVersion(Class<?> clazz, JfireSE jfireSE)
|
public static Serializer buildCompileVersion(Class<?> clazz, JfireSE jfireSE)
|
||||||
{
|
{
|
||||||
List<FieldInfo> parse = parse(clazz, jfireSE);
|
List<FieldInfo> parse = parse(clazz, jfireSE);
|
||||||
|
@ -131,13 +153,16 @@ public class ObjectSerializer implements Serializer
|
||||||
classModel.addField(new FieldModel("UNSAFE", Unsafe.class, "Unsafe.getUnsafe()", classModel));
|
classModel.addField(new FieldModel("UNSAFE", Unsafe.class, "Unsafe.getUnsafe()", classModel));
|
||||||
classModel.addField(new FieldModel("jfireSE", JfireSE.class, classModel));
|
classModel.addField(new FieldModel("jfireSE", JfireSE.class, classModel));
|
||||||
classModel.addField(new FieldModel("clazz", Class.class, classModel));
|
classModel.addField(new FieldModel("clazz", Class.class, classModel));
|
||||||
|
classModel.addField(new FieldModel("list_serializer_compile", List.class, classModel));
|
||||||
ConstructorModel constructorModel = new ConstructorModel(classModel);
|
ConstructorModel constructorModel = new ConstructorModel(classModel);
|
||||||
constructorModel.setParamTypes(Class.class, JfireSE.class, List.class);
|
constructorModel.setParamTypes(Class.class, JfireSE.class, List.class);
|
||||||
constructorModel.setParamNames("clazz", "jfireSE", "list");
|
constructorModel.setParamNames("clazz", "jfireSE", "list");
|
||||||
StringBuilder constructorBody = new StringBuilder();
|
constructorModel.setBody("""
|
||||||
constructorBody.append("""
|
this.jfireSE=jfireSE;
|
||||||
this.jfireSE=jfireSE;
|
this.clazz=clazz;
|
||||||
this.clazz=clazz;""");
|
this.list_serializer_compile = list;""");
|
||||||
|
classModel.addConstructor(constructorModel);
|
||||||
|
StringBuilder initBody = new StringBuilder();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MethodModel writeMethod = new MethodModel(Serializer.class.getDeclaredMethod("writeBytes", ByteArray.class, Object.class), classModel);
|
MethodModel writeMethod = new MethodModel(Serializer.class.getDeclaredMethod("writeBytes", ByteArray.class, Object.class), classModel);
|
||||||
|
@ -150,7 +175,7 @@ public class ObjectSerializer implements Serializer
|
||||||
for (FieldInfo fieldInfo : parse)
|
for (FieldInfo fieldInfo : parse)
|
||||||
{
|
{
|
||||||
long l = UNSAFE.objectFieldOffset(fieldInfo.field);
|
long l = UNSAFE.objectFieldOffset(fieldInfo.field);
|
||||||
if (fieldInfo instanceof PrimitiveFieldInfo primitiveFieldInfo)
|
if (fieldInfo instanceof PrimitiveFieldInfo)
|
||||||
{
|
{
|
||||||
switch (fieldInfo.classId)
|
switch (fieldInfo.classId)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +222,7 @@ public class ObjectSerializer implements Serializer
|
||||||
default -> throw new RuntimeException("不支持的类型");
|
default -> throw new RuntimeException("不支持的类型");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fieldInfo instanceof BoxedFieldInfo boxedFieldInfo)
|
else if (fieldInfo instanceof BoxedFieldInfo)
|
||||||
{
|
{
|
||||||
switch (fieldInfo.classId)
|
switch (fieldInfo.classId)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +288,7 @@ public class ObjectSerializer implements Serializer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byteArray.put(JfireSE.NOT_NULL);
|
byteArray.put(JfireSE.NOT_NULL);
|
||||||
byteArray.writeVarShort(obj);
|
byteArray.writeVarInt(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".replace("offset", String.valueOf(l)));
|
""".replace("offset", String.valueOf(l)));
|
||||||
|
@ -271,7 +296,7 @@ public class ObjectSerializer implements Serializer
|
||||||
{
|
{
|
||||||
if (byteArray.get() == JfireSE.NOT_NULL)
|
if (byteArray.get() == JfireSE.NOT_NULL)
|
||||||
{
|
{
|
||||||
UNSAFE.putReference(instance,offset, byteArray.readVarShort());
|
UNSAFE.putReference(instance,offset, Short.valueOf((short)byteArray.readVarInt()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".replace("offset", String.valueOf(l)));
|
""".replace("offset", String.valueOf(l)));
|
||||||
|
@ -365,7 +390,7 @@ public class ObjectSerializer implements Serializer
|
||||||
byteArray.put(JfireSE.NOT_NULL);
|
byteArray.put(JfireSE.NOT_NULL);
|
||||||
byteArray.writeBoolean(obj);
|
byteArray.writeBoolean(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".replace("offset", String.valueOf(l)));
|
""".replace("offset", String.valueOf(l)));
|
||||||
readBody.append("""
|
readBody.append("""
|
||||||
{
|
{
|
||||||
|
@ -390,7 +415,7 @@ public class ObjectSerializer implements Serializer
|
||||||
byteArray.put(JfireSE.NOT_NULL);
|
byteArray.put(JfireSE.NOT_NULL);
|
||||||
byteArray.writeChar(obj);
|
byteArray.writeChar(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".replace("offset", String.valueOf(l)));
|
""".replace("offset", String.valueOf(l)));
|
||||||
readBody.append("""
|
readBody.append("""
|
||||||
{
|
{
|
||||||
|
@ -415,7 +440,7 @@ public class ObjectSerializer implements Serializer
|
||||||
byteArray.put(JfireSE.NOT_NULL);
|
byteArray.put(JfireSE.NOT_NULL);
|
||||||
byteArray.writeString(obj);
|
byteArray.writeString(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".replace("offset", String.valueOf(l)));
|
""".replace("offset", String.valueOf(l)));
|
||||||
readBody.append("""
|
readBody.append("""
|
||||||
{
|
{
|
||||||
|
@ -436,47 +461,38 @@ public class ObjectSerializer implements Serializer
|
||||||
FieldModel classInfoModel = new FieldModel(classInfoProperty, ClassInfo.class, classModel);
|
FieldModel classInfoModel = new FieldModel(classInfoProperty, ClassInfo.class, classModel);
|
||||||
FieldModel firstClassInfoModel = new FieldModel(firstClassInfoProperty, ClassInfo.class, classModel);
|
FieldModel firstClassInfoModel = new FieldModel(firstClassInfoProperty, ClassInfo.class, classModel);
|
||||||
classModel.addField(classInfoModel, firstClassInfoModel);
|
classModel.addField(classInfoModel, firstClassInfoModel);
|
||||||
constructorBody.append(classInfoProperty + "=jfireSE.getOrCreateClassInfo(((FieldInfo)list.get(" + fieldIndex + ")).getField().getType());\r\n");
|
initBody.append(classInfoProperty).append("=jfireSE.getOrCreateClassInfo(((FieldInfo)list_serializer_compile.get(").append(fieldIndex).append(")).getField().getType());\r\n");
|
||||||
constructorBody.append(" if( ((FieldInfo)list.get(" + fieldIndex + ")).getField().getType().isInterface()) {");
|
initBody.append(" if( ((FieldInfo)list_serializer_compile.get(").append(fieldIndex).append(")).getField().getType().isInterface()) {");
|
||||||
constructorBody.append(firstClassInfoProperty + "=null;\r\n}");
|
initBody.append(firstClassInfoProperty).append("=null;\r\n}");
|
||||||
constructorBody.append("else{\r\n");
|
initBody.append("else{\r\n");
|
||||||
constructorBody.append(firstClassInfoProperty + "=" + classInfoProperty + ";\r\n}");
|
initBody.append(firstClassInfoProperty).append("=").append(classInfoProperty).append(";\r\n}");
|
||||||
String objName = "obj_" + fieldIndex;
|
String objName = "obj_" + fieldIndex;
|
||||||
writeBody.append("Object " + objName + "= UNSAFE.getReference(instance," + l + ");\r\n");
|
writeBody.append("Object ").append(objName).append("= UNSAFE.getReference(instance,").append(l).append(");\r\n");
|
||||||
writeBody.append("if(" + objName + "==null){ byteArray.put(JfireSE.NULL);}\r\n");
|
writeBody.append("if(").append(objName).append("==null){ byteArray.put(JfireSE.NULL);}\r\n");
|
||||||
writeBody.append("else{\r\n");
|
writeBody.append("else{\r\n");
|
||||||
String objClassName = "objClass_$_" + fieldIndex;
|
String objClassName = "objClass_$_" + fieldIndex;
|
||||||
writeBody.append("Class " + objClassName + " = " + objName + ".getClass();\r\n");
|
writeBody.append("Class ").append(objClassName).append(" = ").append(objName).append(".getClass();\r\n");
|
||||||
writeBody.append("if(" + objClassName + "==" + classInfoProperty + ".getClazz()){");
|
writeBody.append("classInfo = classInfo.getClazz() == objClass ? classInfo : jfireSE.getOrCreateClassInfo(objClass);".replace("objClass", objClassName)//
|
||||||
writeBody.append("if(" + classInfoProperty + "==" + firstClassInfoProperty + "){\r\n");
|
.replace("classInfo", classInfoProperty));
|
||||||
writeBody.append(classInfoProperty + ".writeKnownClazz(byteArray," + objName + ");\r\n");
|
writeBody.append("if(").append(classInfoProperty).append("==").append(firstClassInfoProperty).append("){\r\n");
|
||||||
|
writeBody.append(classInfoProperty).append(".writeKnownClazz(byteArray,").append(objName).append(");\r\n");
|
||||||
writeBody.append("}\r\n");
|
writeBody.append("}\r\n");
|
||||||
writeBody.append("else{\r\n");
|
writeBody.append("else{\r\n");
|
||||||
writeBody.append(classInfoProperty + ".write(byteArray," + objName + ");\r\n");
|
writeBody.append(classInfoProperty).append(".write(byteArray,").append(objName).append(");\r\n");
|
||||||
writeBody.append("}\r\n");
|
|
||||||
writeBody.append("}");
|
|
||||||
writeBody.append("else{");
|
|
||||||
writeBody.append(classInfoProperty + "=" + "jfireSE.getOrCreateClassInfo(" + objClassName + ");\r\n");
|
|
||||||
writeBody.append("if(" + classInfoProperty + "==" + firstClassInfoProperty + "){\r\n");
|
|
||||||
writeBody.append(classInfoProperty + ".writeKnownClazz(byteArray," + objName + ");\r\n");
|
|
||||||
writeBody.append("}\r\n");
|
|
||||||
writeBody.append("else{\r\n");
|
|
||||||
writeBody.append(classInfoProperty + ".write(byteArray," + objName + ");\r\n");
|
|
||||||
writeBody.append("}\r\n");
|
writeBody.append("}\r\n");
|
||||||
writeBody.append("}\r\n");
|
writeBody.append("}\r\n");
|
||||||
writeBody.append("}");
|
|
||||||
String flagName = "flag_$_" + fieldIndex;
|
String flagName = "flag_$_" + fieldIndex;
|
||||||
readBody.append("byte " + flagName + " = byteArray.get();\r\n");
|
readBody.append("byte ").append(flagName).append(" = byteArray.get();\r\n");
|
||||||
readBody.append("if(" + flagName + "==JfireSE.NULL){UNSAFE.putReference(instance," + l + ",null);}\r\n");
|
readBody.append("if(").append(flagName).append("==JfireSE.NULL){UNSAFE.putReference(instance,").append(l).append(",null);}\r\n");
|
||||||
readBody.append("else{\r\n");
|
readBody.append("else{\r\n");
|
||||||
readBody.append("switch(" + flagName + "){\r\n");
|
readBody.append("switch(").append(flagName).append("){\r\n");
|
||||||
readBody.append("""
|
readBody.append("""
|
||||||
case JfireSE.NAME_ID_CONTENT_TRACK,JfireSE.NAME_ID_CONTENT_UN_TRACK,JfireSE.ID_INSTANCE_ID,JfireSE.ID_CONTENT_TRACK,JfireSE.ID_CONTENT_UN_TRACK-> UNSAFE.putReference(instance,offset, jfireSE.readByUnderInstanceIdFlag(byteArray, flag));
|
case JfireSE.NAME_ID_CONTENT_TRACK,JfireSE.NAME_ID_CONTENT_UN_TRACK,JfireSE.ID_INSTANCE_ID,JfireSE.ID_CONTENT_TRACK,JfireSE.ID_CONTENT_UN_TRACK-> UNSAFE.putReference(instance,offset, jfireSE.readByUnderInstanceIdFlag(byteArray, flag));
|
||||||
case JfireSE.INSTANCE_ID -> UNSAFE.putReference(instance,offset, firstClassInfo.getInstanceById(byteArray.readPositiveVarInt()));
|
case JfireSE.INSTANCE_ID -> UNSAFE.putReference(instance,offset, firstClassInfo.getInstanceById(byteArray.readPositiveVarInt()));
|
||||||
case JfireSE.CONTENT_TRACK -> UNSAFE.putReference(instance,offset, firstClassInfo.readWithTrack(byteArray));
|
case JfireSE.CONTENT_TRACK -> UNSAFE.putReference(instance,offset, firstClassInfo.readWithTrack(byteArray));
|
||||||
case JfireSE.CONTENT_UN_TRACK -> UNSAFE.putReference(instance,offset, firstClassInfo.readWithoutTrack(byteArray));
|
case JfireSE.CONTENT_UN_TRACK -> UNSAFE.putReference(instance,offset, firstClassInfo.readWithoutTrack(byteArray));
|
||||||
""".replace("offset", String.valueOf(l)).replace("firstClassInfo", firstClassInfoProperty).replace("flag", flagName));
|
""".replace("offset", String.valueOf(l)).replace("firstClassInfo", firstClassInfoProperty).replace("flag", flagName));
|
||||||
readBody.append("default -> throw new RuntimeException(\"flag:\" + " + flagName + ");\r\n");
|
readBody.append("default -> throw new RuntimeException(\"flag:\" + ").append(flagName).append(");\r\n");
|
||||||
readBody.append("}\r\n");
|
readBody.append("}\r\n");
|
||||||
readBody.append("}\r\n");
|
readBody.append("}\r\n");
|
||||||
}
|
}
|
||||||
|
@ -485,7 +501,7 @@ public class ObjectSerializer implements Serializer
|
||||||
String classInfoProperty = "classInfo_$_" + fieldIndex;
|
String classInfoProperty = "classInfo_$_" + fieldIndex;
|
||||||
FieldModel classInfoModel = new FieldModel(classInfoProperty, ClassInfo.class, classModel);
|
FieldModel classInfoModel = new FieldModel(classInfoProperty, ClassInfo.class, classModel);
|
||||||
classModel.addField(classInfoModel);
|
classModel.addField(classInfoModel);
|
||||||
constructorBody.append(classInfoProperty + "=jfireSE.getOrCreateClassInfo(((FieldInfo)list.get(" + fieldIndex + ")).getField().getType());\r\n");
|
initBody.append(classInfoProperty + "=jfireSE.getOrCreateClassInfo(((FieldInfo)list_serializer_compile.get(" + fieldIndex + ")).getField().getType());\r\n");
|
||||||
writeBody.append("""
|
writeBody.append("""
|
||||||
{
|
{
|
||||||
Object obj = UNSAFE.getReference(instance,offset);
|
Object obj = UNSAFE.getReference(instance,offset);
|
||||||
|
@ -514,15 +530,42 @@ public class ObjectSerializer implements Serializer
|
||||||
case JfireSE.CONTENT_TRACK -> UNSAFE.putReference(instance,offset,classInfo.readWithTrack(byteArray));
|
case JfireSE.CONTENT_TRACK -> UNSAFE.putReference(instance,offset,classInfo.readWithTrack(byteArray));
|
||||||
case JfireSE.CONTENT_UN_TRACK -> UNSAFE.putReference(instance,offset,classInfo.readWithoutTrack(byteArray));
|
case JfireSE.CONTENT_UN_TRACK -> UNSAFE.putReference(instance,offset,classInfo.readWithoutTrack(byteArray));
|
||||||
default -> throw new RuntimeException("flag:" + flag);
|
default -> throw new RuntimeException("flag:" + flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".replace("offset", String.valueOf(l)).replace("classInfo", classInfoProperty));
|
""".replace("offset", String.valueOf(l)).replace("classInfo", classInfoProperty));
|
||||||
}
|
}
|
||||||
|
else if (fieldInfo instanceof UnknowObjectFieldInfo)
|
||||||
|
{
|
||||||
|
writeBody.append("""
|
||||||
|
{
|
||||||
|
Object obj = UNSAFE.getReference(instance,offset);
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
byteArray.put(JfireSE.NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jfireSE.getOrCreateClassInfo(obj.getClass()).write(byteArray, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".replace("offset", String.valueOf(l)));
|
||||||
|
readBody.append("""
|
||||||
|
{
|
||||||
|
byte flag = byteArray.get();
|
||||||
|
if (flag == JfireSE.NULL)
|
||||||
|
{
|
||||||
|
UNSAFE.putReference(instance,offset,null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UNSAFE.putReference(instance, offset,jfireSE.readByUnderInstanceIdFlag(byteArray, flag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".replace("offset", String.valueOf(l)));
|
||||||
|
}
|
||||||
fieldIndex++;
|
fieldIndex++;
|
||||||
}
|
}
|
||||||
constructorModel.setBody(constructorBody.toString());
|
|
||||||
classModel.addConstructor(constructorModel);
|
|
||||||
writeMethod.setBody(writeBody.toString());
|
writeMethod.setBody(writeBody.toString());
|
||||||
readBody.append("return instance;\r\n");
|
readBody.append("return instance;\r\n");
|
||||||
readMethod.setBody("""
|
readMethod.setBody("""
|
||||||
|
@ -540,6 +583,9 @@ public class ObjectSerializer implements Serializer
|
||||||
""" + readBody);
|
""" + readBody);
|
||||||
classModel.putMethodModel(writeMethod);
|
classModel.putMethodModel(writeMethod);
|
||||||
classModel.putMethodModel(readMethod);
|
classModel.putMethodModel(readMethod);
|
||||||
|
MethodModel initModel = new MethodModel(Serializer.class.getDeclaredMethod("init"), classModel);
|
||||||
|
initModel.setBody(initBody.toString());
|
||||||
|
classModel.putMethodModel(initModel);
|
||||||
CompileHelper compiler = new CompileHelper(Thread.currentThread().getContextClassLoader());
|
CompileHelper compiler = new CompileHelper(Thread.currentThread().getContextClassLoader());
|
||||||
Class<?> compile = compiler.compile(classModel);
|
Class<?> compile = compiler.compile(classModel);
|
||||||
Serializer compiledObjectSerializer = (Serializer) compile.getDeclaredConstructor(Class.class, JfireSE.class, List.class).newInstance(clazz, jfireSE, parse);
|
Serializer compiledObjectSerializer = (Serializer) compile.getDeclaredConstructor(Class.class, JfireSE.class, List.class).newInstance(clazz, jfireSE, parse);
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.jfirer.se2.serializer.impl.ObjectSerializer;
|
||||||
|
|
||||||
|
import com.jfirer.se2.ByteArray;
|
||||||
|
import com.jfirer.se2.JfireSE;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class UnknowObjectFieldInfo extends FieldInfo
|
||||||
|
{
|
||||||
|
private final JfireSE jfireSE;
|
||||||
|
|
||||||
|
public UnknowObjectFieldInfo(Field field, JfireSE jfireSE)
|
||||||
|
{
|
||||||
|
super(field);
|
||||||
|
this.jfireSE = jfireSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteArray byteArray, Object instance)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
byteArray.put(JfireSE.NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jfireSE.getOrCreateClassInfo(instance.getClass()).write(byteArray, instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteArray byteArray, Object instance)
|
||||||
|
{
|
||||||
|
byte flag = byteArray.get();
|
||||||
|
if (flag == JfireSE.NULL)
|
||||||
|
{
|
||||||
|
accessor.setObject(instance, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
accessor.setObject(instance, jfireSE.readByUnderInstanceIdFlag(byteArray, flag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,13 +10,18 @@ public class VariableFieldInfo extends FieldInfo
|
||||||
{
|
{
|
||||||
private final JfireSE jfireSE;
|
private final JfireSE jfireSE;
|
||||||
private ClassInfo classInfo;
|
private ClassInfo classInfo;
|
||||||
private final ClassInfo firstClassInfo;
|
private ClassInfo firstClassInfo;
|
||||||
|
|
||||||
public VariableFieldInfo(Field field, JfireSE jfireSE)
|
public VariableFieldInfo(Field field, JfireSE jfireSE)
|
||||||
{
|
{
|
||||||
super(field);
|
super(field);
|
||||||
classInfo = jfireSE.getOrCreateClassInfo(field.getType());
|
|
||||||
this.jfireSE = jfireSE;
|
this.jfireSE = jfireSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
classInfo = jfireSE.getOrCreateClassInfo(field.getType());
|
||||||
if (field.getType().isInterface())
|
if (field.getType().isInterface())
|
||||||
{
|
{
|
||||||
firstClassInfo = null;
|
firstClassInfo = null;
|
||||||
|
@ -38,28 +43,14 @@ public class VariableFieldInfo extends FieldInfo
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Class<?> objClass = obj.getClass();
|
Class<?> objClass = obj.getClass();
|
||||||
if (objClass == classInfo.getClazz())
|
classInfo = classInfo.getClazz() == objClass ? classInfo : jfireSE.getOrCreateClassInfo(objClass);
|
||||||
|
if (classInfo == firstClassInfo)
|
||||||
{
|
{
|
||||||
if (classInfo == firstClassInfo)
|
classInfo.writeKnownClazz(byteArray, obj);
|
||||||
{
|
|
||||||
classInfo.writeKnownClazz(byteArray, obj);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
classInfo.write(byteArray, obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
classInfo = jfireSE.getOrCreateClassInfo(objClass);
|
classInfo.write(byteArray, obj);
|
||||||
if (classInfo == firstClassInfo)
|
|
||||||
{
|
|
||||||
classInfo.writeKnownClazz(byteArray, obj);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
classInfo.write(byteArray, obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +67,8 @@ public class VariableFieldInfo extends FieldInfo
|
||||||
{
|
{
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case JfireSE.NAME_ID_CONTENT_TRACK,JfireSE.NAME_ID_CONTENT_UN_TRACK, JfireSE.ID_INSTANCE_ID,JfireSE.ID_CONTENT_TRACK,JfireSE.ID_CONTENT_UN_TRACK -> accessor.setObject(instance, jfireSE.readByUnderInstanceIdFlag(byteArray, flag));
|
case JfireSE.NAME_ID_CONTENT_TRACK, JfireSE.NAME_ID_CONTENT_UN_TRACK, JfireSE.ID_INSTANCE_ID, JfireSE.ID_CONTENT_TRACK,
|
||||||
|
JfireSE.ID_CONTENT_UN_TRACK -> accessor.setObject(instance, jfireSE.readByUnderInstanceIdFlag(byteArray, flag));
|
||||||
case JfireSE.INSTANCE_ID -> accessor.setObject(instance, firstClassInfo.getInstanceById(byteArray.readPositiveVarInt()));
|
case JfireSE.INSTANCE_ID -> accessor.setObject(instance, firstClassInfo.getInstanceById(byteArray.readPositiveVarInt()));
|
||||||
case JfireSE.CONTENT_TRACK -> accessor.setObject(instance, firstClassInfo.readWithTrack(byteArray));
|
case JfireSE.CONTENT_TRACK -> accessor.setObject(instance, firstClassInfo.readWithTrack(byteArray));
|
||||||
case JfireSE.CONTENT_UN_TRACK -> accessor.setObject(instance, firstClassInfo.readWithoutTrack(byteArray));
|
case JfireSE.CONTENT_UN_TRACK -> accessor.setObject(instance, firstClassInfo.readWithoutTrack(byteArray));
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
|
import com.jfirer.se2.ByteArray;
|
||||||
|
import com.jfirer.se2.classinfo.RefTracking;
|
||||||
|
import com.jfirer.se2.serializer.Serializer;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
public class CalendarSerializer implements Serializer
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void writeBytes(ByteArray byteArray, Object instance)
|
||||||
|
{
|
||||||
|
byteArray.writeVarLong(((Calendar) instance).getTimeInMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object read(ByteArray byteArray, RefTracking refTracking)
|
||||||
|
{
|
||||||
|
long l = byteArray.readVarLong();
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTimeInMillis(l);
|
||||||
|
return calendar;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
|
import com.jfirer.se2.ByteArray;
|
||||||
|
import com.jfirer.se2.classinfo.RefTracking;
|
||||||
|
import com.jfirer.se2.serializer.Serializer;
|
||||||
|
|
||||||
|
public class ClassSerializer implements Serializer
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void writeBytes(ByteArray byteArray, Object instance)
|
||||||
|
{
|
||||||
|
Class<?> clz = (Class<?>) instance;
|
||||||
|
byteArray.writeString(clz.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object read(ByteArray byteArray, RefTracking refTracking)
|
||||||
|
{
|
||||||
|
String name = byteArray.readString();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Class.forName(name);
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jfirer.se2.serializer.impl;
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
import com.jfirer.se2.ByteArray;
|
import com.jfirer.se2.ByteArray;
|
||||||
import com.jfirer.se2.classinfo.RefTracking;
|
import com.jfirer.se2.classinfo.RefTracking;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jfirer.se2.serializer.impl;
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
import com.jfirer.se2.ByteArray;
|
import com.jfirer.se2.ByteArray;
|
||||||
import com.jfirer.se2.JfireSE;
|
import com.jfirer.se2.JfireSE;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jfirer.se2.serializer.impl;
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
import com.jfirer.se2.ByteArray;
|
import com.jfirer.se2.ByteArray;
|
||||||
import com.jfirer.se2.JfireSE;
|
import com.jfirer.se2.JfireSE;
|
||||||
|
@ -23,7 +23,7 @@ public class MapSerializer implements Serializer
|
||||||
public MapSerializer(JfireSE jfireSE, Class<? extends Map> type)
|
public MapSerializer(JfireSE jfireSE, Class<? extends Map> type)
|
||||||
{
|
{
|
||||||
this.jfireSE = jfireSE;
|
this.jfireSE = jfireSE;
|
||||||
if (type.equals(Map.class))
|
if (type.equals(HashMap.class))
|
||||||
{
|
{
|
||||||
this.type = HASHMAP;
|
this.type = HASHMAP;
|
||||||
}
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
|
import com.jfirer.baseutil.reflect.ReflectUtil;
|
||||||
|
import com.jfirer.se2.ByteArray;
|
||||||
|
import com.jfirer.se2.classinfo.RefTracking;
|
||||||
|
import com.jfirer.se2.serializer.Serializer;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class MethodSerializer implements Serializer
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void writeBytes(ByteArray byteArray, Object instance)
|
||||||
|
{
|
||||||
|
Method method = (Method) instance;
|
||||||
|
byteArray.writeString(method.getDeclaringClass().getName());
|
||||||
|
byteArray.writeString(method.getName());
|
||||||
|
byteArray.writePositiveVarInt(method.getParameterCount());
|
||||||
|
for (Class<?> each : method.getParameterTypes())
|
||||||
|
{
|
||||||
|
byteArray.writeString(each.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object read(ByteArray byteArray, RefTracking refTracking)
|
||||||
|
{
|
||||||
|
String className = byteArray.readString();
|
||||||
|
String methodName = byteArray.readString();
|
||||||
|
int parameterCount = byteArray.readPositiveVarInt();
|
||||||
|
if (parameterCount == 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Class.forName(className).getDeclaredMethod(methodName);
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
ReflectUtil.throwException(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?>[] parameterTypes = new Class[parameterCount];
|
||||||
|
for (int i = 0; i < parameterCount; i++)
|
||||||
|
{
|
||||||
|
parameterTypes[i] = Class.forName(byteArray.readString());
|
||||||
|
}
|
||||||
|
return Class.forName(className).getDeclaredMethod(methodName, parameterTypes);
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
ReflectUtil.throwException(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jfirer.se2.serializer.impl;
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
import com.jfirer.se2.ByteArray;
|
import com.jfirer.se2.ByteArray;
|
||||||
import com.jfirer.se2.JfireSE;
|
import com.jfirer.se2.JfireSE;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jfirer.se2.serializer.impl;
|
package com.jfirer.se2.serializer.impl.jdk;
|
||||||
|
|
||||||
import com.jfirer.se2.ByteArray;
|
import com.jfirer.se2.ByteArray;
|
||||||
import com.jfirer.se2.classinfo.RefTracking;
|
import com.jfirer.se2.classinfo.RefTracking;
|
|
@ -47,11 +47,13 @@ public class FunctionTest
|
||||||
@Test
|
@Test
|
||||||
public void test3()
|
public void test3()
|
||||||
{
|
{
|
||||||
Fury fury = Fury.builder().requireClassRegistration(false).build();
|
Fury fury = Fury.builder().requireClassRegistration(false).withRefTracking(true).build();
|
||||||
TestData[] data = new TestData[2];
|
Home home = new Home();
|
||||||
data[0] = new TestData();
|
Person person = new Person();
|
||||||
fury.serialize(data);
|
home.setPerson(person);
|
||||||
|
person.setHome(home);
|
||||||
|
fury.serialize(home);
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
jfireSE.serialize(home);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Home
|
||||||
|
{
|
||||||
|
private int size;
|
||||||
|
private Person person;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Person
|
||||||
|
{
|
||||||
|
private int age;
|
||||||
|
private Home home;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import com.jfirer.se2.JfireSE;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class BaseTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void test()
|
||||||
|
{
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
User user = new User();
|
||||||
|
user.setAge(123);
|
||||||
|
user.setName("aaa");
|
||||||
|
Home home = new Home();
|
||||||
|
home.setAddress("ssss");
|
||||||
|
home.setUser(user);
|
||||||
|
user.setHome(home);
|
||||||
|
byte[] serialize = jfireSE.serialize(user);
|
||||||
|
User another = (User) jfireSE.deSerialize(serialize);
|
||||||
|
Assert.assertEquals(user.getAge(), another.getAge());
|
||||||
|
Assert.assertEquals(user.getName(), another.getName());
|
||||||
|
Home home1 = user.getHome();
|
||||||
|
Assert.assertEquals(home.getAddress(), home1.getAddress());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import com.jfirer.fse.ByteArray;
|
||||||
|
import com.jfirer.se2.JfireSE;
|
||||||
|
import org.apache.fury.Fury;
|
||||||
|
import org.apache.fury.config.Language;
|
||||||
|
import org.openjdk.jmh.annotations.*;
|
||||||
|
import org.openjdk.jmh.runner.Runner;
|
||||||
|
import org.openjdk.jmh.runner.RunnerException;
|
||||||
|
import org.openjdk.jmh.runner.options.Options;
|
||||||
|
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@BenchmarkMode(Mode.Throughput)
|
||||||
|
@Warmup(iterations = 2, time = 1)
|
||||||
|
@Measurement(iterations = 3, time = 3)
|
||||||
|
@Threads(1)
|
||||||
|
@Fork(2)
|
||||||
|
@OutputTimeUnit(TimeUnit.SECONDS)
|
||||||
|
@State(Scope.Benchmark)
|
||||||
|
public class BenchMark
|
||||||
|
{
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
TestData data = new TestData();
|
||||||
|
ByteArray buf = ByteArray.allocate(100);
|
||||||
|
Fury fury = Fury.builder().withLanguage(Language.JAVA)//
|
||||||
|
.requireClassRegistration(false)//
|
||||||
|
.withRefTracking(true).build();
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public void testFury()
|
||||||
|
{
|
||||||
|
byte[] bytes = fury.serialize(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public void testJfireSE()
|
||||||
|
{
|
||||||
|
jfireSE.serialize(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws RunnerException
|
||||||
|
{
|
||||||
|
Options opt = new OptionsBuilder().include(BenchMark.class.getSimpleName()).build();
|
||||||
|
new Runner(opt).run();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
|
||||||
|
public class Home
|
||||||
|
{
|
||||||
|
private String address;
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
public String getAddress()
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address)
|
||||||
|
{
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser()
|
||||||
|
{
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user)
|
||||||
|
{
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
public class LongData2
|
||||||
|
{
|
||||||
|
private int a = 213212312;
|
||||||
|
private boolean b = false;
|
||||||
|
private char c = 'c';
|
||||||
|
private byte d = 0x11;
|
||||||
|
private short e = 24;
|
||||||
|
private long f = 1213124131312321L;
|
||||||
|
private double g = 231321.2132;
|
||||||
|
private float h = (float) 4986.2;
|
||||||
|
private String name = "林斌";
|
||||||
|
|
||||||
|
public int getA()
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(int a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isB()
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(boolean b)
|
||||||
|
{
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getC()
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC(char c)
|
||||||
|
{
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getD()
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(byte d)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getE()
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setE(short e)
|
||||||
|
{
|
||||||
|
this.e = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getF()
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF(long f)
|
||||||
|
{
|
||||||
|
this.f = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getG()
|
||||||
|
{
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setG(double g)
|
||||||
|
{
|
||||||
|
this.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getH()
|
||||||
|
{
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setH(float h)
|
||||||
|
{
|
||||||
|
this.h = h;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import com.esotericsoftware.kryo.Kryo;
|
||||||
|
import com.esotericsoftware.kryo.io.Output;
|
||||||
|
import com.jfirer.se2.JfireSE;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.example.festest.data.BaseData;
|
||||||
|
import org.example.festest.data.LongData;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class LongTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void longtest() throws IllegalArgumentException, IllegalAccessException, UnsupportedEncodingException, ClassNotFoundException, InstantiationException
|
||||||
|
{
|
||||||
|
Kryo kryo = new Kryo();
|
||||||
|
kryo.setReferences(true);
|
||||||
|
Output output = null;
|
||||||
|
output = new Output(1, 15096);
|
||||||
|
kryo.writeClassAndObject(output, new LongData());
|
||||||
|
byte[] bb = output.toBytes();
|
||||||
|
System.out.println("LongData序列化:kryo基础数据长度:" + bb.length);
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(new LongData());
|
||||||
|
System.out.println("LongData序列化:jfirese基础数据长度:" + serialize.length);
|
||||||
|
System.out.println("序列化长度减少" + (bb.length - serialize.length));
|
||||||
|
output = new Output(1, 15096);
|
||||||
|
kryo.writeClassAndObject(output, new BaseData(1));
|
||||||
|
bb = output.toBytes();
|
||||||
|
log.debug("basedata序列化:kryo基础数据长度:{}", bb.length);
|
||||||
|
byte[] serialize1 = jfireSE.serialize(new BaseData(1));
|
||||||
|
log.info("basedata序列化:jfirese基础数据长度:" + serialize1.length);
|
||||||
|
log.info("序列化长度减少{}", (bb.length - serialize1.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import com.jfirer.se2.JfireSE;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.example.festest.data.BaseData;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class MapTest
|
||||||
|
{
|
||||||
|
@Data
|
||||||
|
public class MapDemo
|
||||||
|
{
|
||||||
|
private HashMap<Integer, BaseData> map = new HashMap<Integer, BaseData>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test()
|
||||||
|
{
|
||||||
|
MapDemo demo = new MapDemo();
|
||||||
|
demo.getMap().put(1, new BaseData());
|
||||||
|
JfireSE jfireSE = JfireSE.staticRegisterClass(MapDemo.class).refTracking().build();
|
||||||
|
byte[] serialize = jfireSE.serialize(demo);
|
||||||
|
jfireSE.deSerialize(serialize);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class RandomString
|
||||||
|
{
|
||||||
|
private static Random random = new Random();
|
||||||
|
private static char[] numbers = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
|
||||||
|
private static char[] charAndNumbers = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到一个随机的数字串,位数由参数指定
|
||||||
|
*
|
||||||
|
* @param size
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getNumber(int size)
|
||||||
|
{
|
||||||
|
char[] tmp = new char[size];
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = numbers[random.nextInt(10)];
|
||||||
|
}
|
||||||
|
return new String(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回一个长度为size的随机字符串,可能包含数字和字母
|
||||||
|
*
|
||||||
|
* @param size
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String randomString(int size)
|
||||||
|
{
|
||||||
|
char[] tmp = new char[size];
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = charAndNumbers[random.nextInt(62)];
|
||||||
|
}
|
||||||
|
return new String(tmp);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,283 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import com.jfirer.se2.JfireSE;
|
||||||
|
import org.example.festest.data.*;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class RightTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void baseTypeTest() throws IllegalArgumentException, IllegalAccessException, UnsupportedEncodingException, ClassNotFoundException, InstantiationException
|
||||||
|
{
|
||||||
|
// 创建需要序列化的对象
|
||||||
|
BaseData baseData = new BaseData(1);
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).staticRegisterClass(baseData.getClass()).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(baseData);
|
||||||
|
// 传入二进制buffer对象,读取其中的 数据并且反序列化成对象
|
||||||
|
BaseData result = (BaseData) jfireSE.deSerialize(serialize);
|
||||||
|
assertEquals(result.getA(), baseData.getA());
|
||||||
|
assertEquals(result.isB(), baseData.isB());
|
||||||
|
assertEquals(result.getC(), baseData.getC());
|
||||||
|
assertEquals(result.getD(), baseData.getD());
|
||||||
|
assertEquals(result.getE(), baseData.getE());
|
||||||
|
assertEquals(result.getF(), baseData.getF());
|
||||||
|
assertEquals(result.getG(), baseData.getG(), 0.01);
|
||||||
|
assertEquals(result.getI(), baseData.getI());
|
||||||
|
assertEquals(result.getH(), baseData.getH(), 0.01);
|
||||||
|
for (int i = 0; i < result.getJ().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getJ()[i], baseData.getJ()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getK().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getK()[i], baseData.getK()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getL().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getL()[i], baseData.getL()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getM().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getM()[i], baseData.getM()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getN().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getN()[i], baseData.getN()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getO().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getO()[i], baseData.getO()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getP().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getP()[i], baseData.getP()[i], 0.1);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getQ().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getQ()[i], baseData.getQ()[i], 0.1);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getR().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getR()[i], baseData.getR()[i]);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void wrapTest() throws IllegalArgumentException, IllegalAccessException, UnsupportedEncodingException, ClassNotFoundException, InstantiationException
|
||||||
|
{
|
||||||
|
WrapData wrapData = new WrapData();
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).staticRegisterClass(WrapData.class).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(wrapData);
|
||||||
|
WrapData result = (WrapData) jfireSE.deSerialize(serialize);
|
||||||
|
assertEquals(result.getA(), wrapData.getA());
|
||||||
|
assertEquals(result.getB(), wrapData.getB());
|
||||||
|
assertEquals(result.getC(), wrapData.getC());
|
||||||
|
assertEquals(result.getD(), wrapData.getD());
|
||||||
|
assertEquals(result.getE(), wrapData.getE());
|
||||||
|
assertEquals(result.getF(), wrapData.getF());
|
||||||
|
assertEquals(result.getG(), wrapData.getG(), 0.01);
|
||||||
|
assertEquals(result.getH(), wrapData.getH(), 0.01);
|
||||||
|
assertEquals(result.getI(), wrapData.getI());
|
||||||
|
for (int i = 0; i < result.getJ().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getJ()[i], wrapData.getJ()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getK().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getK()[i], wrapData.getK()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getL().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getL()[i], wrapData.getL()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getM().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getM()[i], wrapData.getM()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getN().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getN()[i], wrapData.getN()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getO().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getO()[i], wrapData.getO()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getP().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getP()[i], wrapData.getP()[i], 0.1);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getQ().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getQ()[i], wrapData.getQ()[i], 0.1);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getR().length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(result.getR()[i], wrapData.getR()[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < wrapData.getList().size(); i++)
|
||||||
|
{
|
||||||
|
BaseData a = wrapData.getList().get(i);
|
||||||
|
BaseData b = result.getList().get(i);
|
||||||
|
Assert.assertTrue(a.equals(b));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < wrapData.getMap().size(); i++)
|
||||||
|
{
|
||||||
|
Assert.assertTrue(wrapData.getMap().get(i).equals(result.getMap().get(i)));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < wrapData.getW().length; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < wrapData.getW()[i].length; j++)
|
||||||
|
{
|
||||||
|
Assert.assertEquals(result.getW()[i][j], wrapData.getW()[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void referenceTest()
|
||||||
|
{
|
||||||
|
Person person = new Person("linbin", 25);
|
||||||
|
Person tPerson = new Person("zhangshi[in", 30);
|
||||||
|
person.setLeader(tPerson);
|
||||||
|
tPerson.setLeader(person);
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(person);
|
||||||
|
Person result = (Person) jfireSE.deSerialize(serialize);
|
||||||
|
assertEquals("zhangshi[in", result.getLeader().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void objectTest() throws IllegalArgumentException, IllegalAccessException, ClassNotFoundException, InstantiationException
|
||||||
|
{
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
byte[] serialize = jfireSE.serialize(calendar);
|
||||||
|
Calendar reCalendar = (Calendar) jfireSE.deSerialize(serialize);
|
||||||
|
Assert.assertTrue(reCalendar.equals(calendar));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test
|
||||||
|
public void listTest() throws IllegalArgumentException, IllegalAccessException, ClassNotFoundException, InstantiationException
|
||||||
|
{
|
||||||
|
ArrayList<BaseData> list = new ArrayList<BaseData>();
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
list.add(new BaseData(i));
|
||||||
|
}
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(list);
|
||||||
|
ArrayList<BaseData> result = (ArrayList<BaseData>) jfireSE.deSerialize(serialize);
|
||||||
|
Assert.assertTrue(list.equals(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void baseDataTest()
|
||||||
|
{
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
BaseData baseData = new BaseData();
|
||||||
|
byte[] serialize = jfireSE.serialize(baseData);
|
||||||
|
BaseData result = (BaseData) jfireSE.deSerialize(serialize);
|
||||||
|
assertTrue(result.equals(baseData));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void objectArrayTest()
|
||||||
|
{
|
||||||
|
Object[] array = new Object[4];
|
||||||
|
array[0] = new Person();
|
||||||
|
array[1] = new BaseData();
|
||||||
|
array[2] = new LongData();
|
||||||
|
array[3] = new WrapData();
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(array);
|
||||||
|
Object[] result = (Object[]) jfireSE.deSerialize(serialize);
|
||||||
|
Assert.assertTrue(((Person) result[0]).equals(array[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void byteArrayTest()
|
||||||
|
{
|
||||||
|
byte[] array = new byte[]{1, 2, 5, 6, 8, 9};
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(array);
|
||||||
|
byte[] result = (byte[]) jfireSE.deSerialize(serialize);
|
||||||
|
for (int i = 0; i < array.length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(array[i], result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void booleanArrayTest()
|
||||||
|
{
|
||||||
|
boolean[] array = new boolean[]{true, false, false, true, true, true};
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(array);
|
||||||
|
boolean[] result = (boolean[]) jfireSE.deSerialize(serialize);
|
||||||
|
for (int i = 0; i < array.length; i++)
|
||||||
|
{
|
||||||
|
assertEquals(array[i], result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void arrayDataTest()
|
||||||
|
{
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(new ArrayData());
|
||||||
|
jfireSE.deSerialize(serialize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void objectArrTest()
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
byte[] key = new byte[16];
|
||||||
|
random.nextBytes(key);
|
||||||
|
Object[] data = new Object[]{Integer.valueOf(14), new BaseData[]{new BaseData(), new BaseData()}};
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(data);
|
||||||
|
Object[] result = (Object[]) jfireSE.deSerialize(serialize);
|
||||||
|
assertEquals(14, result[0]);
|
||||||
|
assertEquals(((BaseData[]) data[1])[0], ((BaseData[]) result[1])[0]);
|
||||||
|
assertEquals(((BaseData[]) data[1])[1], ((BaseData[]) result[1])[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不注册类型直接序列化时,数组实例多次被引用能够正确序列化
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void arryaNotRegisterClassSeri()
|
||||||
|
{
|
||||||
|
ArrayRefenceHolder holder = new ArrayRefenceHolder();
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(holder);
|
||||||
|
ArrayRefenceHolder result = (ArrayRefenceHolder) jfireSE.deSerialize(serialize);
|
||||||
|
assertArrayEquals(new int[]{1, 2}, result.getA()[0]);
|
||||||
|
assertArrayEquals(new int[]{3, 4}, result.getA()[1]);
|
||||||
|
assertArrayEquals(new int[]{1, 2}, result.getB()[0]);
|
||||||
|
assertArrayEquals(new int[]{3, 4}, result.getB()[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void methodObjectTest() throws NoSuchMethodException
|
||||||
|
{
|
||||||
|
Method methodObjectTest = this.getClass().getDeclaredMethod("methodObjectTest");
|
||||||
|
JfireSE jfireSE = JfireSE.supportRefTracking(true).build();
|
||||||
|
byte[] serialize = jfireSE.serialize(methodObjectTest);
|
||||||
|
Method method = (Method) jfireSE.deSerialize(serialize);
|
||||||
|
System.out.println(method.equals(methodObjectTest));
|
||||||
|
assertEquals(methodObjectTest, method);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
public class SimplePerson
|
||||||
|
{
|
||||||
|
private int age;
|
||||||
|
private String name;
|
||||||
|
private Float weight;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "Person{" + "age=" + age + ", name='" + name + '\'' + ", weight=" + weight + '}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object x)
|
||||||
|
{
|
||||||
|
if (x instanceof SimplePerson)
|
||||||
|
{
|
||||||
|
SimplePerson target = (SimplePerson) x;
|
||||||
|
if (target.age == age && name.equals(target.name) && target.weight.floatValue() == weight.floatValue())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge()
|
||||||
|
{
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age)
|
||||||
|
{
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getWeight()
|
||||||
|
{
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(Float weight)
|
||||||
|
{
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestData implements Serializable
|
||||||
|
{
|
||||||
|
private int a = 213212312;
|
||||||
|
private boolean b = false;
|
||||||
|
private char c = 'c';
|
||||||
|
private byte d = 0x11;
|
||||||
|
private short e = 24;
|
||||||
|
private long f = 1213124131312321L;
|
||||||
|
private double g = 231321.2132;
|
||||||
|
private float h = (float) 4986.2;
|
||||||
|
private String i = "123452312316789a";
|
||||||
|
// private int[] j = new int[]{1, 2, 4, 5};
|
||||||
|
// private boolean[] k = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
// private char[] l = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
// private byte[] m = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
// private short[] n = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
// private long[] o = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
// private double[] p = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
// private float[] q = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
// private String[] r = new String[]{"abcdf12345", "abdfcgf12323"};
|
||||||
|
|
||||||
|
public boolean equals(Object x)
|
||||||
|
{
|
||||||
|
if (x instanceof TestData)
|
||||||
|
{
|
||||||
|
TestData target = (TestData) x;
|
||||||
|
if (target.a == a && target.b == b && target.c == c && target.d == d && target.e == e && target.f == f && target.g == g && target.h == h && target.i.equals(i))
|
||||||
|
{
|
||||||
|
// for (int i = 0; i < target.j.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.j[i] != j[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < k.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.k[i] != k[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < l.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.l[i] != l[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < m.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.m[i] != m[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < n.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.n[i] != n[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < o.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.o[i] != o[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < p.length; i++)
|
||||||
|
// {
|
||||||
|
// if (p[i] != target.p[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < r.length; i++)
|
||||||
|
// {
|
||||||
|
// if (target.r[i].equals(r[i]) == false)
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < q.length; i++)
|
||||||
|
// {
|
||||||
|
// if (q[i] != target.q[i])
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.example.festest;
|
||||||
|
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
private int age;
|
||||||
|
private String name;
|
||||||
|
private Home home;
|
||||||
|
|
||||||
|
public Home getHome()
|
||||||
|
{
|
||||||
|
return home;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHome(Home home)
|
||||||
|
{
|
||||||
|
this.home = home;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge()
|
||||||
|
{
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age)
|
||||||
|
{
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
public class ArrayData
|
||||||
|
{
|
||||||
|
private Object j1 = new int[]{1, 2, 4, 5};
|
||||||
|
private Object k1 = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private Object l1 = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private Object m1 = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private Object n1 = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private Object o1 = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private Object p1 = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private Object q1 = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private Object r1 = new String[]{"adasdasdasd", "dsadq2eafsa"};
|
||||||
|
|
||||||
|
public Object getK1()
|
||||||
|
{
|
||||||
|
return k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK1(Object k1)
|
||||||
|
{
|
||||||
|
this.k1 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getL1()
|
||||||
|
{
|
||||||
|
return l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL1(Object l1)
|
||||||
|
{
|
||||||
|
this.l1 = l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getM1()
|
||||||
|
{
|
||||||
|
return m1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM1(Object m1)
|
||||||
|
{
|
||||||
|
this.m1 = m1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getN1()
|
||||||
|
{
|
||||||
|
return n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN1(Object n1)
|
||||||
|
{
|
||||||
|
this.n1 = n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getO1()
|
||||||
|
{
|
||||||
|
return o1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO1(Object o1)
|
||||||
|
{
|
||||||
|
this.o1 = o1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getP1()
|
||||||
|
{
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP1(Object p1)
|
||||||
|
{
|
||||||
|
this.p1 = p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getQ1()
|
||||||
|
{
|
||||||
|
return q1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ1(Object q1)
|
||||||
|
{
|
||||||
|
this.q1 = q1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getR1()
|
||||||
|
{
|
||||||
|
return r1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR1(Object r1)
|
||||||
|
{
|
||||||
|
this.r1 = r1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getJ1()
|
||||||
|
{
|
||||||
|
return j1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ1(Object j1)
|
||||||
|
{
|
||||||
|
this.j1 = j1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
public class ArrayRefenceHolder
|
||||||
|
{
|
||||||
|
private int[][] a;
|
||||||
|
private int[][] b;
|
||||||
|
|
||||||
|
public ArrayRefenceHolder()
|
||||||
|
{
|
||||||
|
a = new int[][]{{1, 2}, {3, 4}};
|
||||||
|
b = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getA()
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getB()
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(int[][] b)
|
||||||
|
{
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(int[][] a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,556 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import org.example.festest.RandomString;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BaseData implements Serializable
|
||||||
|
{
|
||||||
|
public int a = 213212312;
|
||||||
|
private Date[] dates = new Date[]{new Date(13536156), new Date(54454655)};
|
||||||
|
private int index = 0;
|
||||||
|
private boolean b = false;
|
||||||
|
private char c = 'c';
|
||||||
|
private byte d = 0x11;
|
||||||
|
private short e = 24;
|
||||||
|
private long f = 1213124131312321L;
|
||||||
|
private double g = 231321.2132;
|
||||||
|
private float h = (float) 4986.2;
|
||||||
|
private String i = "123452312316789a";
|
||||||
|
private int[] j = new int[]{1, 2, 4, 5};
|
||||||
|
private boolean[] k = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private char[] l = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private byte[] m = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private short[] n = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private long[] o = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private double[] p = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private float[] q = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private String[] r = new String[]{"abcdf12345", "abdfcgf12323"};
|
||||||
|
private int[][] j2 = new int[][]{{1, 2, 4, 5}, {1, 2, 3, 4, 5, 6}};
|
||||||
|
private boolean[][] k2 = new boolean[][]{{true, false, true, false, false, false, true}, {true, false, true, false, false, false, false}};
|
||||||
|
private char[][] l2 = new char[][]{{'a', 'v', 'q', 'j', 'h', 'e', 'f'}, {'a', 'v', 'q', 'j', 'h', 'e', 'f'}};
|
||||||
|
private byte[][] m2 = new byte[][]{{0x32, 0x12, 0x34, (byte) 0x96}, {0x32, 0x12, 0x34, (byte) 0x96}};
|
||||||
|
private short[][] n2 = new short[][]{{3, 8, 213, 451, 312, 45}, {3, 8, 213, 451, 312, 45}};
|
||||||
|
private long[][] o2 = new long[][]{{12313131313l, 524141431313l, 3131231231425l, 1313123121l}, {12313131313l, 524141431313l, 3131231231425l, 1313123121l}};
|
||||||
|
private double[][] p2 = new double[][]{{6468613646.48646d, 4646.456d, 546864648867.466d}, {6468613646.48646d, 4646.456d, 546864648867.466d}};
|
||||||
|
private float[][] q2 = new float[][]{{46486.2f, 49849.2f, 646854.6f}, {46486.2f, 49849.2f, 646854.6f}};
|
||||||
|
private String[][] r2 = new String[2][];
|
||||||
|
|
||||||
|
private Object j1 = new int[]{1, 2, 4, 5};
|
||||||
|
private Object k1 = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private Object l1 = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private Object m1 = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private Object n1 = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private Object o1 = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private Object p1 = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private Object q1 = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private Object r1 = new String[]{"adaseqeddasdasd", "dsadqeq2eafsa"};
|
||||||
|
|
||||||
|
public BaseData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseData(int index)
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
this.index = index;
|
||||||
|
i = String.valueOf(System.nanoTime() + random.nextInt());
|
||||||
|
r[0] = RandomString.randomString(20);
|
||||||
|
r[1] = RandomString.randomString(20);
|
||||||
|
((String[]) r1)[0] = RandomString.randomString(20);
|
||||||
|
((String[]) r1)[1] = RandomString.randomString(20);
|
||||||
|
r2[0] = new String[]{RandomString.randomString(20), RandomString.randomString(20)};
|
||||||
|
r2[1] = new String[]{RandomString.randomString(20), RandomString.randomString(20)};
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object target)
|
||||||
|
{
|
||||||
|
if (target instanceof BaseData)
|
||||||
|
{
|
||||||
|
BaseData baseData = this;
|
||||||
|
BaseData result = (BaseData) target;
|
||||||
|
if (baseData.getIndex() != result.getIndex())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.getA() != baseData.getA())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.isB() != baseData.isB())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.getC() != baseData.getC())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.getD() != baseData.getD())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.getE() != baseData.getE())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.getH() != baseData.getH())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (result.getI().equals(baseData.getI()) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getJ().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getJ()[i] != baseData.getJ()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getK().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getK()[i] != baseData.getK()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getL().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getL()[i] != baseData.getL()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getM().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getM()[i] != baseData.getM()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getN().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getN()[i] != baseData.getN()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getO().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getO()[i] != baseData.getO()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getP().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getP()[i] != baseData.getP()[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < result.getR().length; i++)
|
||||||
|
{
|
||||||
|
if (result.getR()[i].equals(baseData.getR()[i]) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < ((int[]) result.getJ1()).length; i++)
|
||||||
|
{
|
||||||
|
if (((int[]) result.getJ1())[i] != ((int[]) baseData.getJ1())[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public short[] getN()
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(short[] n)
|
||||||
|
{
|
||||||
|
this.n = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex()
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index)
|
||||||
|
{
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getA()
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(int a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isB()
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(boolean b)
|
||||||
|
{
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getC()
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC(char c)
|
||||||
|
{
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getD()
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(byte d)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getE()
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setE(short e)
|
||||||
|
{
|
||||||
|
this.e = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getF()
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF(long f)
|
||||||
|
{
|
||||||
|
this.f = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getG()
|
||||||
|
{
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setG(double g)
|
||||||
|
{
|
||||||
|
this.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getH()
|
||||||
|
{
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setH(float h)
|
||||||
|
{
|
||||||
|
this.h = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getI()
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setI(String i)
|
||||||
|
{
|
||||||
|
this.i = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getJ()
|
||||||
|
{
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ(int[] j)
|
||||||
|
{
|
||||||
|
this.j = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean[] getK()
|
||||||
|
{
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK(boolean[] k)
|
||||||
|
{
|
||||||
|
this.k = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[] getL()
|
||||||
|
{
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL(char[] l)
|
||||||
|
{
|
||||||
|
this.l = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getM()
|
||||||
|
{
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM(byte[] m)
|
||||||
|
{
|
||||||
|
this.m = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long[] getO()
|
||||||
|
{
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO(long[] o)
|
||||||
|
{
|
||||||
|
this.o = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] getP()
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP(double[] p)
|
||||||
|
{
|
||||||
|
this.p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] getQ()
|
||||||
|
{
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ(float[] q)
|
||||||
|
{
|
||||||
|
this.q = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getR()
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR(String[] r)
|
||||||
|
{
|
||||||
|
this.r = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getJ2()
|
||||||
|
{
|
||||||
|
return j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ2(int[][] j2)
|
||||||
|
{
|
||||||
|
this.j2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean[][] getK2()
|
||||||
|
{
|
||||||
|
return k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK2(boolean[][] k2)
|
||||||
|
{
|
||||||
|
this.k2 = k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[][] getL2()
|
||||||
|
{
|
||||||
|
return l2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL2(char[][] l2)
|
||||||
|
{
|
||||||
|
this.l2 = l2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[][] getM2()
|
||||||
|
{
|
||||||
|
return m2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM2(byte[][] m2)
|
||||||
|
{
|
||||||
|
this.m2 = m2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short[][] getN2()
|
||||||
|
{
|
||||||
|
return n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN2(short[][] n2)
|
||||||
|
{
|
||||||
|
this.n2 = n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long[][] getO2()
|
||||||
|
{
|
||||||
|
return o2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO2(long[][] o2)
|
||||||
|
{
|
||||||
|
this.o2 = o2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[][] getP2()
|
||||||
|
{
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP2(double[][] p2)
|
||||||
|
{
|
||||||
|
this.p2 = p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[][] getQ2()
|
||||||
|
{
|
||||||
|
return q2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ2(float[][] q2)
|
||||||
|
{
|
||||||
|
this.q2 = q2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[][] getR2()
|
||||||
|
{
|
||||||
|
return r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR2(String[][] r2)
|
||||||
|
{
|
||||||
|
this.r2 = r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getJ1()
|
||||||
|
{
|
||||||
|
return j1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ1(Object j1)
|
||||||
|
{
|
||||||
|
this.j1 = j1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getK1()
|
||||||
|
{
|
||||||
|
return k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK1(Object k1)
|
||||||
|
{
|
||||||
|
this.k1 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getL1()
|
||||||
|
{
|
||||||
|
return l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL1(Object l1)
|
||||||
|
{
|
||||||
|
this.l1 = l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getM1()
|
||||||
|
{
|
||||||
|
return m1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM1(Object m1)
|
||||||
|
{
|
||||||
|
this.m1 = m1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getN1()
|
||||||
|
{
|
||||||
|
return n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN1(Object n1)
|
||||||
|
{
|
||||||
|
this.n1 = n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getO1()
|
||||||
|
{
|
||||||
|
return o1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO1(Object o1)
|
||||||
|
{
|
||||||
|
this.o1 = o1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getP1()
|
||||||
|
{
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP1(Object p1)
|
||||||
|
{
|
||||||
|
this.p1 = p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getQ1()
|
||||||
|
{
|
||||||
|
return q1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ1(Object q1)
|
||||||
|
{
|
||||||
|
this.q1 = q1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getR1()
|
||||||
|
{
|
||||||
|
return r1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR1(Object r1)
|
||||||
|
{
|
||||||
|
this.r1 = r1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date[] getDates()
|
||||||
|
{
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDates(Date[] dates)
|
||||||
|
{
|
||||||
|
this.dates = dates;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,420 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Device entity. @author MyEclipse Persistence Tools
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Device implements java.io.Serializable
|
||||||
|
{
|
||||||
|
// Fields
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -7833130819750178757L;
|
||||||
|
private long id;
|
||||||
|
private String sn;
|
||||||
|
private String udid;
|
||||||
|
private String openUdid;
|
||||||
|
private String uuid;
|
||||||
|
private String idfa;
|
||||||
|
private String imei;
|
||||||
|
private String mac;
|
||||||
|
private int majorVersion;
|
||||||
|
private int minorVersion;
|
||||||
|
private int buildVersion;
|
||||||
|
private int os;
|
||||||
|
private String osVersion;
|
||||||
|
private int promoPlatformCode;
|
||||||
|
private Date activationTime;
|
||||||
|
private long userId;
|
||||||
|
private boolean bound;
|
||||||
|
|
||||||
|
private int[] j = new int[]{1, 2, 4, 5};
|
||||||
|
private boolean[] k = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private char[] l = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private byte[] m = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private short[] n = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private long[] o = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private double[] p = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private float[] q = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private String[] r = new String[]{"abcdf12345", "abdfcgf12323"};
|
||||||
|
private int[][] j2 = new int[][]{{1, 2, 4, 5}, {1, 2, 3, 4, 5, 6}};
|
||||||
|
private boolean[][] k2 = new boolean[][]{{true, false, true, false, false, false, true}, {true, false, true, false, false, false, false}};
|
||||||
|
private char[][] l2 = new char[][]{{'a', 'v', 'q', 'j', 'h', 'e', 'f'}, {'a', 'v', 'q', 'j', 'h', 'e', 'f'}};
|
||||||
|
private byte[][] m2 = new byte[][]{{0x32, 0x12, 0x34, (byte) 0x96}, {0x32, 0x12, 0x34, (byte) 0x96}};
|
||||||
|
private short[][] n2 = new short[][]{{3, 8, 213, 451, 312, 45}, {3, 8, 213, 451, 312, 45}};
|
||||||
|
private long[][] o2 = new long[][]{{12313131313l, 524141431313l, 3131231231425l, 1313123121l}, {12313131313l, 524141431313l, 3131231231425l, 1313123121l}};
|
||||||
|
private double[][] p2 = new double[][]{{6468613646.48646d, 4646.456d, 546864648867.466d}, {6468613646.48646d, 4646.456d, 546864648867.466d}};
|
||||||
|
private float[][] q2 = new float[][]{{46486.2f, 49849.2f, 646854.6f}, {46486.2f, 49849.2f, 646854.6f}};
|
||||||
|
private String[][] r2 = new String[][]{{"12qw", "sad123"}, {"xdr234", "5986sad"}};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public Device()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getSerialversionuid()
|
||||||
|
{
|
||||||
|
return serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getSerialVersionUID()
|
||||||
|
{
|
||||||
|
return serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSn()
|
||||||
|
{
|
||||||
|
return sn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSn(String sn)
|
||||||
|
{
|
||||||
|
this.sn = sn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUdid()
|
||||||
|
{
|
||||||
|
return udid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUdid(String udid)
|
||||||
|
{
|
||||||
|
this.udid = udid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenUdid()
|
||||||
|
{
|
||||||
|
return openUdid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenUdid(String openUdid)
|
||||||
|
{
|
||||||
|
this.openUdid = openUdid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid()
|
||||||
|
{
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid)
|
||||||
|
{
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdfa()
|
||||||
|
{
|
||||||
|
return idfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdfa(String idfa)
|
||||||
|
{
|
||||||
|
this.idfa = idfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImei()
|
||||||
|
{
|
||||||
|
return imei;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImei(String imei)
|
||||||
|
{
|
||||||
|
this.imei = imei;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMac()
|
||||||
|
{
|
||||||
|
return mac;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMac(String mac)
|
||||||
|
{
|
||||||
|
this.mac = mac;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMajorVersion()
|
||||||
|
{
|
||||||
|
return majorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMajorVersion(int majorVersion)
|
||||||
|
{
|
||||||
|
this.majorVersion = majorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinorVersion()
|
||||||
|
{
|
||||||
|
return minorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinorVersion(int minorVersion)
|
||||||
|
{
|
||||||
|
this.minorVersion = minorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBuildVersion()
|
||||||
|
{
|
||||||
|
return buildVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuildVersion(int buildVersion)
|
||||||
|
{
|
||||||
|
this.buildVersion = buildVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOs()
|
||||||
|
{
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOs(int os)
|
||||||
|
{
|
||||||
|
this.os = os;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOsVersion()
|
||||||
|
{
|
||||||
|
return osVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOsVersion(String osVersion)
|
||||||
|
{
|
||||||
|
this.osVersion = osVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPromoPlatformCode()
|
||||||
|
{
|
||||||
|
return promoPlatformCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPromoPlatformCode(int promoPlatformCode)
|
||||||
|
{
|
||||||
|
this.promoPlatformCode = promoPlatformCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getActivationTime()
|
||||||
|
{
|
||||||
|
return activationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivationTime(Date activationTime)
|
||||||
|
{
|
||||||
|
this.activationTime = activationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(long userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBound()
|
||||||
|
{
|
||||||
|
return bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBound(boolean bound)
|
||||||
|
{
|
||||||
|
this.bound = bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getJ()
|
||||||
|
{
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ(int[] j)
|
||||||
|
{
|
||||||
|
this.j = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean[] getK()
|
||||||
|
{
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK(boolean[] k)
|
||||||
|
{
|
||||||
|
this.k = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[] getL()
|
||||||
|
{
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL(char[] l)
|
||||||
|
{
|
||||||
|
this.l = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getM()
|
||||||
|
{
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM(byte[] m)
|
||||||
|
{
|
||||||
|
this.m = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short[] getN()
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(short[] n)
|
||||||
|
{
|
||||||
|
this.n = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long[] getO()
|
||||||
|
{
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO(long[] o)
|
||||||
|
{
|
||||||
|
this.o = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] getP()
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP(double[] p)
|
||||||
|
{
|
||||||
|
this.p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] getQ()
|
||||||
|
{
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ(float[] q)
|
||||||
|
{
|
||||||
|
this.q = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getR()
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR(String[] r)
|
||||||
|
{
|
||||||
|
this.r = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getJ2()
|
||||||
|
{
|
||||||
|
return j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ2(int[][] j2)
|
||||||
|
{
|
||||||
|
this.j2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean[][] getK2()
|
||||||
|
{
|
||||||
|
return k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK2(boolean[][] k2)
|
||||||
|
{
|
||||||
|
this.k2 = k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[][] getL2()
|
||||||
|
{
|
||||||
|
return l2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL2(char[][] l2)
|
||||||
|
{
|
||||||
|
this.l2 = l2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[][] getM2()
|
||||||
|
{
|
||||||
|
return m2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM2(byte[][] m2)
|
||||||
|
{
|
||||||
|
this.m2 = m2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short[][] getN2()
|
||||||
|
{
|
||||||
|
return n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN2(short[][] n2)
|
||||||
|
{
|
||||||
|
this.n2 = n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long[][] getO2()
|
||||||
|
{
|
||||||
|
return o2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO2(long[][] o2)
|
||||||
|
{
|
||||||
|
this.o2 = o2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[][] getP2()
|
||||||
|
{
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP2(double[][] p2)
|
||||||
|
{
|
||||||
|
this.p2 = p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[][] getQ2()
|
||||||
|
{
|
||||||
|
return q2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ2(float[][] q2)
|
||||||
|
{
|
||||||
|
this.q2 = q2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[][] getR2()
|
||||||
|
{
|
||||||
|
return r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR2(String[][] r2)
|
||||||
|
{
|
||||||
|
this.r2 = r2;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,624 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LongData
|
||||||
|
{
|
||||||
|
private int a = 213212312;
|
||||||
|
private boolean b = false;
|
||||||
|
private char c = 'c';
|
||||||
|
private byte d = 0x11;
|
||||||
|
private short e = 24;
|
||||||
|
private long f = 1213124131312321L;
|
||||||
|
private double g = 231321.2132;
|
||||||
|
private float h = (float) 4986.2;
|
||||||
|
private String i = "dzzz";
|
||||||
|
private int[] j = new int[]{1, 2, 4, 5};
|
||||||
|
private boolean[] k = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private char[] l = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private byte[] m = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private short[] n = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private long[] o = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private double[] p = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private float[] q = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private String[] r = new String[]{"adasdccczzzzasdasd", "dsadqzzzzzzz2eafsa"};
|
||||||
|
private Integer a1 = 213212312;
|
||||||
|
private Boolean b1 = false;
|
||||||
|
private Character c1 = 'd';
|
||||||
|
private Byte d1 = 0x11;
|
||||||
|
private Short e1 = 24;
|
||||||
|
private Long f1 = 1213124131312321L;
|
||||||
|
private Double g1 = 231321.2132;
|
||||||
|
private Float h1 = (float) 4986.2;
|
||||||
|
private Integer[] j1 = new Integer[]{1, 2, 4, 5};
|
||||||
|
private Boolean[] k1 = new Boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private Character[] l1 = new Character[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private Byte[] m1 = new Byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private Short[] n1 = new Short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private Long[] o1 = new Long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private Double[] p1 = new Double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private Float[] q1 = new Float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private int[][] w = new int[][]{{1, 2}, {3, 4, 5}};
|
||||||
|
private List<BaseData> list = new ArrayList<BaseData>();
|
||||||
|
private HashMap<Integer, BaseData> map = new HashMap<Integer, BaseData>();
|
||||||
|
private Object j2 = new int[]{1, 2, 4, 5};
|
||||||
|
private Object k2 = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private Object l2 = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private Object m2 = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private Object n2 = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private Object o2 = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private Object p2 = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private Object q2 = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private Object r2 = new String[]{"adasdasccccccccccccccdasd", "dsadq2eccccccccafsa"};
|
||||||
|
private Object j3 = new Integer[]{1, 2, 4, 5};
|
||||||
|
private Object k3 = new Boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private Object l3 = new Character[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private Object m3 = new Byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private Object n3 = new Short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private Object o3 = new Long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private Double[] p3 = new Double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private Float[] q3 = new Float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private int[][] w3 = new int[][]{{1, 2}, {3, 4, 5}};
|
||||||
|
|
||||||
|
// private BaseData baseData = new BaseData();
|
||||||
|
public LongData()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
list.add(new BaseData(i));
|
||||||
|
map.put(i, new BaseData(i + 11));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getA()
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(int a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isB()
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(boolean b)
|
||||||
|
{
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getC()
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC(char c)
|
||||||
|
{
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getD()
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(byte d)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getE()
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setE(short e)
|
||||||
|
{
|
||||||
|
this.e = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getF()
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF(long f)
|
||||||
|
{
|
||||||
|
this.f = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getG()
|
||||||
|
{
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setG(double g)
|
||||||
|
{
|
||||||
|
this.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getH()
|
||||||
|
{
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setH(float h)
|
||||||
|
{
|
||||||
|
this.h = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getI()
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setI(String i)
|
||||||
|
{
|
||||||
|
this.i = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getJ()
|
||||||
|
{
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ(int[] j)
|
||||||
|
{
|
||||||
|
this.j = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean[] getK()
|
||||||
|
{
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK(boolean[] k)
|
||||||
|
{
|
||||||
|
this.k = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[] getL()
|
||||||
|
{
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL(char[] l)
|
||||||
|
{
|
||||||
|
this.l = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getM()
|
||||||
|
{
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM(byte[] m)
|
||||||
|
{
|
||||||
|
this.m = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short[] getN()
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(short[] n)
|
||||||
|
{
|
||||||
|
this.n = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long[] getO()
|
||||||
|
{
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO(long[] o)
|
||||||
|
{
|
||||||
|
this.o = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] getP()
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP(double[] p)
|
||||||
|
{
|
||||||
|
this.p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] getQ()
|
||||||
|
{
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ(float[] q)
|
||||||
|
{
|
||||||
|
this.q = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getR()
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR(String[] r)
|
||||||
|
{
|
||||||
|
this.r = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getA1()
|
||||||
|
{
|
||||||
|
return a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(Integer a1)
|
||||||
|
{
|
||||||
|
this.a1 = a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getB1()
|
||||||
|
{
|
||||||
|
return b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB1(Boolean b1)
|
||||||
|
{
|
||||||
|
this.b1 = b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character getC1()
|
||||||
|
{
|
||||||
|
return c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC1(Character c1)
|
||||||
|
{
|
||||||
|
this.c1 = c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte getD1()
|
||||||
|
{
|
||||||
|
return d1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD1(Byte d1)
|
||||||
|
{
|
||||||
|
this.d1 = d1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getE1()
|
||||||
|
{
|
||||||
|
return e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setE1(Short e1)
|
||||||
|
{
|
||||||
|
this.e1 = e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getF1()
|
||||||
|
{
|
||||||
|
return f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF1(Long f1)
|
||||||
|
{
|
||||||
|
this.f1 = f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getG1()
|
||||||
|
{
|
||||||
|
return g1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setG1(Double g1)
|
||||||
|
{
|
||||||
|
this.g1 = g1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getH1()
|
||||||
|
{
|
||||||
|
return h1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setH1(Float h1)
|
||||||
|
{
|
||||||
|
this.h1 = h1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer[] getJ1()
|
||||||
|
{
|
||||||
|
return j1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ1(Integer[] j1)
|
||||||
|
{
|
||||||
|
this.j1 = j1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean[] getK1()
|
||||||
|
{
|
||||||
|
return k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK1(Boolean[] k1)
|
||||||
|
{
|
||||||
|
this.k1 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character[] getL1()
|
||||||
|
{
|
||||||
|
return l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL1(Character[] l1)
|
||||||
|
{
|
||||||
|
this.l1 = l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte[] getM1()
|
||||||
|
{
|
||||||
|
return m1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM1(Byte[] m1)
|
||||||
|
{
|
||||||
|
this.m1 = m1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short[] getN1()
|
||||||
|
{
|
||||||
|
return n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN1(Short[] n1)
|
||||||
|
{
|
||||||
|
this.n1 = n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long[] getO1()
|
||||||
|
{
|
||||||
|
return o1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO1(Long[] o1)
|
||||||
|
{
|
||||||
|
this.o1 = o1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double[] getP1()
|
||||||
|
{
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP1(Double[] p1)
|
||||||
|
{
|
||||||
|
this.p1 = p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float[] getQ1()
|
||||||
|
{
|
||||||
|
return q1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ1(Float[] q1)
|
||||||
|
{
|
||||||
|
this.q1 = q1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getW()
|
||||||
|
{
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setW(int[][] w)
|
||||||
|
{
|
||||||
|
this.w = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BaseData> getList()
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<BaseData> list)
|
||||||
|
{
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<Integer, BaseData> getMap()
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(HashMap<Integer, BaseData> map)
|
||||||
|
{
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getJ2()
|
||||||
|
{
|
||||||
|
return j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ2(Object j2)
|
||||||
|
{
|
||||||
|
this.j2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getK2()
|
||||||
|
{
|
||||||
|
return k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK2(Object k2)
|
||||||
|
{
|
||||||
|
this.k2 = k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getL2()
|
||||||
|
{
|
||||||
|
return l2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL2(Object l2)
|
||||||
|
{
|
||||||
|
this.l2 = l2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getM2()
|
||||||
|
{
|
||||||
|
return m2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM2(Object m2)
|
||||||
|
{
|
||||||
|
this.m2 = m2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getN2()
|
||||||
|
{
|
||||||
|
return n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN2(Object n2)
|
||||||
|
{
|
||||||
|
this.n2 = n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getO2()
|
||||||
|
{
|
||||||
|
return o2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO2(Object o2)
|
||||||
|
{
|
||||||
|
this.o2 = o2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getP2()
|
||||||
|
{
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP2(Object p2)
|
||||||
|
{
|
||||||
|
this.p2 = p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getQ2()
|
||||||
|
{
|
||||||
|
return q2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ2(Object q2)
|
||||||
|
{
|
||||||
|
this.q2 = q2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getR2()
|
||||||
|
{
|
||||||
|
return r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR2(Object r2)
|
||||||
|
{
|
||||||
|
this.r2 = r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getJ3()
|
||||||
|
{
|
||||||
|
return j3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ3(Object j3)
|
||||||
|
{
|
||||||
|
this.j3 = j3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getK3()
|
||||||
|
{
|
||||||
|
return k3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK3(Object k3)
|
||||||
|
{
|
||||||
|
this.k3 = k3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getL3()
|
||||||
|
{
|
||||||
|
return l3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL3(Object l3)
|
||||||
|
{
|
||||||
|
this.l3 = l3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getM3()
|
||||||
|
{
|
||||||
|
return m3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM3(Object m3)
|
||||||
|
{
|
||||||
|
this.m3 = m3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getN3()
|
||||||
|
{
|
||||||
|
return n3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN3(Object n3)
|
||||||
|
{
|
||||||
|
this.n3 = n3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getO3()
|
||||||
|
{
|
||||||
|
return o3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO3(Object o3)
|
||||||
|
{
|
||||||
|
this.o3 = o3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double[] getP3()
|
||||||
|
{
|
||||||
|
return p3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP3(Double[] p3)
|
||||||
|
{
|
||||||
|
this.p3 = p3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float[] getQ3()
|
||||||
|
{
|
||||||
|
return q3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ3(Float[] q3)
|
||||||
|
{
|
||||||
|
this.q3 = q3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getW3()
|
||||||
|
{
|
||||||
|
return w3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setW3(int[][] w3)
|
||||||
|
{
|
||||||
|
this.w3 = w3;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
public class NewBaseData
|
||||||
|
{
|
||||||
|
public int a = 213212312;
|
||||||
|
private int index = 0;
|
||||||
|
private boolean b = false;
|
||||||
|
private char c = 'c';
|
||||||
|
private byte d = 0x11;
|
||||||
|
private short e = 24;
|
||||||
|
private long f = 1213124131312321L;
|
||||||
|
private double g = 231321.2132;
|
||||||
|
private float h = (float) 4986.2;
|
||||||
|
private String i = "123452312316789a";
|
||||||
|
private int[] j = new int[]{1, 2, 4, 5};
|
||||||
|
private boolean[] k = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
|
||||||
|
public int getIndex()
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index)
|
||||||
|
{
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getA()
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(int a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isB()
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(boolean b)
|
||||||
|
{
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getC()
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC(char c)
|
||||||
|
{
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getD()
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(byte d)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getE()
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setE(short e)
|
||||||
|
{
|
||||||
|
this.e = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getF()
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF(long f)
|
||||||
|
{
|
||||||
|
this.f = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getG()
|
||||||
|
{
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setG(double g)
|
||||||
|
{
|
||||||
|
this.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getH()
|
||||||
|
{
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setH(float h)
|
||||||
|
{
|
||||||
|
this.h = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getI()
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setI(String i)
|
||||||
|
{
|
||||||
|
this.i = i;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class Person implements Serializable
|
||||||
|
{
|
||||||
|
public String name;
|
||||||
|
public int age = 56;
|
||||||
|
public Person leader;
|
||||||
|
private List<BaseData> list = new ArrayList<BaseData>();
|
||||||
|
private Map<Integer, BaseData> map = new HashMap<Integer, BaseData>();
|
||||||
|
private int[][] w = new int[][]{{1, 2}, {3, 4, 5}};
|
||||||
|
private Date date = new Date();
|
||||||
|
|
||||||
|
public Person()
|
||||||
|
{
|
||||||
|
this("linbin", 25);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person(String name, int age)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
list.add(new BaseData(i));
|
||||||
|
map.put(i, new BaseData(i + 30));
|
||||||
|
}
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String args[]) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, NoSuchMethodException
|
||||||
|
{
|
||||||
|
Field w = Person.class.getDeclaredField("w");
|
||||||
|
Person.class.getDeclaredMethod("setW",w.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object target)
|
||||||
|
{
|
||||||
|
if (target instanceof Person)
|
||||||
|
{
|
||||||
|
Person person = (Person) target;
|
||||||
|
if (name.equals(person.getName()) && age == person.getAge() && date.equals(person.getDate()) && list.equals(person.getList()) && map.equals(person.getMap()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BaseData> getList()
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<BaseData> list)
|
||||||
|
{
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, BaseData> getMap()
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(Map<Integer, BaseData> map)
|
||||||
|
{
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getW()
|
||||||
|
{
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setW(int[][] w)
|
||||||
|
{
|
||||||
|
this.w = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate()
|
||||||
|
{
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date)
|
||||||
|
{
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAge()
|
||||||
|
{
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age)
|
||||||
|
{
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person getLeader()
|
||||||
|
{
|
||||||
|
return leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeader(Person leader)
|
||||||
|
{
|
||||||
|
this.leader = leader;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import org.example.festest.RandomString;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SpeedData
|
||||||
|
{
|
||||||
|
public int a = 213212312;
|
||||||
|
private Date[] dates = new Date[]{new Date(13536156), new Date(54454655)};
|
||||||
|
private int index = 0;
|
||||||
|
private boolean b = false;
|
||||||
|
private char c = 'c';
|
||||||
|
private byte d = 0x11;
|
||||||
|
private short e = 24;
|
||||||
|
private long f = 1213124131312321L;
|
||||||
|
private double g = 231321.2132;
|
||||||
|
private float h = (float) 4986.2;
|
||||||
|
private String i = RandomString.randomString(15);
|
||||||
|
private int[] j = new int[]{1, 2, 4, 5};
|
||||||
|
private boolean[] k = new boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private char[] l = new char[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private byte[] m = new byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private short[] n = new short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private long[] o = new long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private double[] p = new double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private float[] q = new float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private String[] r = new String[] { "abcdf12345", "abdfcgf12323" };
|
||||||
|
private int[][] j2 = new int[][] { { 1, 2, 4, 5 }, { 1, 2, 3, 4, 5, 6 } };
|
||||||
|
private boolean[][] k2 = new boolean[][] { { true, false, true, false, false, false, true }, { true, false, true, false, false, false, false } };
|
||||||
|
private char[][] l2 = new char[][] { { 'a', 'v', 'q', 'j', 'h', 'e', 'f' }, { 'a', 'v', 'q', 'j', 'h', 'e', 'f' } };
|
||||||
|
private byte[][] m2 = new byte[][] { { 0x32, 0x12, 0x34, (byte) 0x96 }, { 0x32, 0x12, 0x34, (byte) 0x96 } };
|
||||||
|
private short[][] n2 = new short[][] { { 3, 8, 213, 451, 312, 45 }, { 3, 8, 213, 451, 312, 45 } };
|
||||||
|
private long[][] o2 = new long[][] { { 12313131313l, 524141431313l, 3131231231425l, 1313123121l }, { 12313131313l, 524141431313l, 3131231231425l, 1313123121l } };
|
||||||
|
private double[][] p2 = new double[][] { { 6468613646.48646d, 4646.456d, 546864648867.466d }, { 6468613646.48646d, 4646.456d, 546864648867.466d } };
|
||||||
|
private float[][] q2 = new float[][] { { 46486.2f, 49849.2f, 646854.6f }, { 46486.2f, 49849.2f, 646854.6f } };
|
||||||
|
private String[][] r2 = new String[2][];
|
||||||
|
//
|
||||||
|
private Object j1 = new int[] { 1, 2, 4, 5 };
|
||||||
|
private Object k1 = new boolean[] { true, false, true, false, false, false, true };
|
||||||
|
private Object l1 = new char[] { 'a', 'v', 'q', 'j', 'h', 'e', 'f' };
|
||||||
|
private Object m1 = new byte[] { 0x32, 0x12, 0x34, (byte) 0x96 };
|
||||||
|
private Object n1 = new short[] { 3, 8, 213, 451, 312, 45 };
|
||||||
|
private Object o1 = new long[] { 12313131313l, 524141431313l, 3131231231425l, 1313123121l };
|
||||||
|
private Object p1 = new double[] { 6468613646.48646d, 4646.456d, 546864648867.466d };
|
||||||
|
private Object q1 = new float[] { 46486.2f, 49849.2f, 646854.6f };
|
||||||
|
private Object r1 = new String[] { "adas122林斌eqeddasdasd", "dsadqeq2eafsa" };
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SpeedData2
|
||||||
|
{
|
||||||
|
// private Integer a = 213212312;
|
||||||
|
// private Boolean b = true;
|
||||||
|
// private Character c = 'd';
|
||||||
|
// private Byte d = 0x11;
|
||||||
|
// private Short e = 24;
|
||||||
|
// private Long f = 1213124131312321L;
|
||||||
|
// private Double g = 231321.2132;
|
||||||
|
// private Float h = (float) 4986.2;
|
||||||
|
// private Date i = new Date(466846979467694l);
|
||||||
|
// private Integer[] j = new Integer[] { 1, 2, 4, 5 };
|
||||||
|
// private Boolean[] k = new Boolean[] { true, false, true, false, false,
|
||||||
|
// false, true };
|
||||||
|
// private Character[] l = new Character[] { 'a', 'v', 'q', 'j', 'h', 'e',
|
||||||
|
// 'f' };
|
||||||
|
// private Byte[] m = new Byte[] { 0x32, 0x12, 0x34, (byte) 0x96 };
|
||||||
|
// private Short[] n = new Short[] { 3, 8, 213, 451, 312, 45 };
|
||||||
|
// private Long[] o = new Long[] { 12313131313l, 524141431313l,
|
||||||
|
// 3131231231425l, 1313123121l };
|
||||||
|
// private Double[] p = new Double[] { 6468613646.48646d, 4646.456d,
|
||||||
|
// 546864648867.466d };
|
||||||
|
// private Float[] q = new Float[] { 46486.2f, 49849.2f, 646854.6f };
|
||||||
|
// private Date[] r = new Date[] { new Date(4646876464684l), new
|
||||||
|
// Date(231323123121l) };
|
||||||
|
// private int[][] w = new int[][] { { 1, 2 }, { 3, 4, 5 } };
|
||||||
|
private List<SpeedData> list = new ArrayList<SpeedData>();
|
||||||
|
private HashMap<Integer, SpeedData> map = new HashMap<Integer, SpeedData>();
|
||||||
|
// private SpeedData speedData = new SpeedData();
|
||||||
|
|
||||||
|
public SpeedData2()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 20; i++)
|
||||||
|
{
|
||||||
|
SpeedData baseData = new SpeedData();
|
||||||
|
list.add(baseData);
|
||||||
|
// map.put(i, baseData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,248 @@
|
||||||
|
package org.example.festest.data;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class WrapData
|
||||||
|
{
|
||||||
|
private Integer a = 213212312;
|
||||||
|
private Boolean b = true;
|
||||||
|
private Character c = 'd';
|
||||||
|
private Byte d = 0x11;
|
||||||
|
private Short e = 24;
|
||||||
|
private Long f = 1213124131312321L;
|
||||||
|
private Double g = 231321.2132;
|
||||||
|
private Float h = (float) 4986.2;
|
||||||
|
private Date i = new Date(466846979467694l);
|
||||||
|
private Integer[] j = new Integer[]{1, 2, 4, 5};
|
||||||
|
private Boolean[] k = new Boolean[]{true, false, true, false, false, false, true};
|
||||||
|
private Character[] l = new Character[]{'a', 'v', 'q', 'j', 'h', 'e', 'f'};
|
||||||
|
private Byte[] m = new Byte[]{0x32, 0x12, 0x34, (byte) 0x96};
|
||||||
|
private Short[] n = new Short[]{3, 8, 213, 451, 312, 45};
|
||||||
|
private Long[] o = new Long[]{12313131313l, 524141431313l, 3131231231425l, 1313123121l};
|
||||||
|
private Double[] p = new Double[]{6468613646.48646d, 4646.456d, 546864648867.466d};
|
||||||
|
private Float[] q = new Float[]{46486.2f, 49849.2f, 646854.6f};
|
||||||
|
private Date[] r = new Date[]{new Date(4646876464684l), new Date(231323123121l)};
|
||||||
|
private int[][] w = new int[][]{{1, 2}, {3, 4, 5}};
|
||||||
|
private List<BaseData> list = new ArrayList<BaseData>();
|
||||||
|
private HashMap<Integer, BaseData> map = new HashMap<Integer, BaseData>();
|
||||||
|
|
||||||
|
public WrapData()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
BaseData baseData = new BaseData(i);
|
||||||
|
list.add(baseData);
|
||||||
|
// map.put(i, baseData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getA()
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(Integer a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getB()
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(Boolean b)
|
||||||
|
{
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character getC()
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC(Character c)
|
||||||
|
{
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte getD()
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(Byte d)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getE()
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setE(Short e)
|
||||||
|
{
|
||||||
|
this.e = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getF()
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF(Long f)
|
||||||
|
{
|
||||||
|
this.f = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getG()
|
||||||
|
{
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setG(Double g)
|
||||||
|
{
|
||||||
|
this.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getH()
|
||||||
|
{
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setH(Float h)
|
||||||
|
{
|
||||||
|
this.h = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getI()
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setI(Date i)
|
||||||
|
{
|
||||||
|
this.i = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer[] getJ()
|
||||||
|
{
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJ(Integer[] j)
|
||||||
|
{
|
||||||
|
this.j = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean[] getK()
|
||||||
|
{
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK(Boolean[] k)
|
||||||
|
{
|
||||||
|
this.k = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character[] getL()
|
||||||
|
{
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setL(Character[] l)
|
||||||
|
{
|
||||||
|
this.l = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte[] getM()
|
||||||
|
{
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM(Byte[] m)
|
||||||
|
{
|
||||||
|
this.m = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short[] getN()
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(Short[] n)
|
||||||
|
{
|
||||||
|
this.n = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long[] getO()
|
||||||
|
{
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO(Long[] o)
|
||||||
|
{
|
||||||
|
this.o = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double[] getP()
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setP(Double[] p)
|
||||||
|
{
|
||||||
|
this.p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float[] getQ()
|
||||||
|
{
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ(Float[] q)
|
||||||
|
{
|
||||||
|
this.q = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date[] getR()
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR(Date[] r)
|
||||||
|
{
|
||||||
|
this.r = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getW()
|
||||||
|
{
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setW(int[][] w)
|
||||||
|
{
|
||||||
|
this.w = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BaseData> getList()
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<BaseData> list)
|
||||||
|
{
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, BaseData> getMap()
|
||||||
|
{
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(HashMap<Integer, BaseData> map)
|
||||||
|
{
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<Configuration>
|
||||||
|
<Appenders>
|
||||||
|
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="%d %-5p [%t] %m (%F:%L)%n"/>
|
||||||
|
</Console>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Logger name="org.example" level="debug"/>
|
||||||
|
<Root level="debug">
|
||||||
|
<AppenderRef ref="STDOUT"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
Loading…
Reference in New Issue