public class SerializerPojo extends SerializerBase implements Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
SerializerPojo.ClassInfo
Stores info about single class stored in MapDB.
|
protected static class |
SerializerPojo.FieldInfo
Stores info about single field stored in MapDB.
|
protected class |
SerializerPojo.ObjectInputStream2 |
protected class |
SerializerPojo.ObjectOutputStream2 |
SerializerBase.FastArrayList<K>, SerializerBase.Header, SerializerBase.HeaderMapDB, SerializerBase.singletons
Serializer.CompressionWrapper<E>
Modifier and Type | Field and Description |
---|---|
protected static Method |
androidConstructor |
protected Map<Class<?>,Integer> |
class2classId |
protected static Map<Class<?>,Constructor<?>> |
class2constuctor |
protected Map<Integer,Class<?>> |
classId2class |
protected DB |
db |
protected ReentrantReadWriteLock |
lock |
protected int |
oldSize |
protected CopyOnWriteArrayList<SerializerPojo.ClassInfo> |
registered |
protected CopyOnWriteArrayList<Fun.Function1> |
serializationTransformsDeserialize |
protected CopyOnWriteArrayList<Fun.Function1> |
serializationTransformsSerialize |
protected static Serializer<CopyOnWriteArrayList<SerializerPojo.ClassInfo>> |
serializer |
protected static Method |
sunConstructor |
protected static Object |
sunReflFac |
EMPTY_STRING
BASIC, BOOLEAN, BYTE_ARRAY, BYTE_ARRAY_NOSIZE, CHAR_ARRAY, DOUBLE_ARRAY, ILLEGAL_ACCESS, INT_ARRAY, INTEGER, JAVA, LONG, LONG_ARRAY, STRING, STRING_ASCII, STRING_INTERN, STRING_NOSIZE, UUID
Constructor and Description |
---|
SerializerPojo(CopyOnWriteArrayList<SerializerPojo.ClassInfo> registered) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertClassSerializable(Class<?> clazz) |
protected static Class<?> |
classForName(String className) |
boolean |
containsClass(Class<?> clazz) |
protected <T> T |
createInstanceSkippinkConstructor(Class<T> clazz)
For pojo serialization we need to instantiate class without invoking its constructor.
|
Object |
deserialize(DataInput is,
int capacity)
Deserialize the content of an object from a DataInput.
|
protected Object |
deserializeUnknownHeader(DataInput in,
int head,
SerializerBase.FastArrayList<Object> objectStack)
override this method to extend SerializerBase functionality
|
int |
getClassId(Class<?> clazz) |
protected Engine |
getEngine() |
protected ObjectStreamField[] |
getFields(Class<?> clazz) |
Object |
getFieldValue(SerializerPojo.FieldInfo fieldInfo,
Object object) |
boolean |
hasUnsavedChanges() |
void |
registerClass(Class<?> clazz) |
void |
save(Engine e) |
protected void |
saveClassInfo()
action performed after classInfo was modified, feel free to override
|
void |
serialize(DataOutput out,
Object obj)
Serialize the content of an object into a ObjectOutput
|
<A,R> void |
serializerTransformAdd(Fun.Function1<A,R> beforeSerialization,
Fun.Function1<R,A> afterDeserialization)
Add interceptor which may modify all deserialized/serialized objects
|
<A,R> void |
serializerTransformRemove(Fun.Function1<A,R> beforeSerialization,
Fun.Function1<R,A> afterDeserialization)
Removes interceptor which may modify all deserialized/serialized objects
|
protected void |
serializeUnknownObject(DataOutput out,
Object obj,
SerializerBase.FastArrayList<Object> objectStack)
override this method to extend SerializerBase functionality
|
protected void |
setDb(DB db) |
void |
setFieldValue(SerializerPojo.FieldInfo fieldInfo,
Object object,
Object value) |
protected boolean |
usesAdvancedSerialization(Class<?> clazz) |
assertSerializable, booleanToByteArray, deserialize, deserializeClass, deserializeMapDB, fixedSize, readBooleanArray, serialize, serializeClass
protected static final Serializer<CopyOnWriteArrayList<SerializerPojo.ClassInfo>> serializer
protected final ReentrantReadWriteLock lock
protected DB db
protected CopyOnWriteArrayList<SerializerPojo.ClassInfo> registered
protected static Method sunConstructor
protected static Object sunReflFac
protected static Method androidConstructor
protected static Map<Class<?>,Constructor<?>> class2constuctor
protected int oldSize
protected CopyOnWriteArrayList<Fun.Function1> serializationTransformsSerialize
protected CopyOnWriteArrayList<Fun.Function1> serializationTransformsDeserialize
public SerializerPojo(CopyOnWriteArrayList<SerializerPojo.ClassInfo> registered)
protected void setDb(DB db)
public void registerClass(Class<?> clazz) throws IOException
IOException
protected boolean usesAdvancedSerialization(Class<?> clazz)
protected void saveClassInfo()
protected ObjectStreamField[] getFields(Class<?> clazz)
protected void assertClassSerializable(Class<?> clazz) throws NotSerializableException, InvalidClassException
public Object getFieldValue(SerializerPojo.FieldInfo fieldInfo, Object object)
public void setFieldValue(SerializerPojo.FieldInfo fieldInfo, Object object, Object value)
public boolean containsClass(Class<?> clazz)
public int getClassId(Class<?> clazz)
protected Engine getEngine()
getEngine
in class SerializerBase
protected void serializeUnknownObject(DataOutput out, Object obj, SerializerBase.FastArrayList<Object> objectStack) throws IOException
SerializerBase
serializeUnknownObject
in class SerializerBase
IOException
protected Object deserializeUnknownHeader(DataInput in, int head, SerializerBase.FastArrayList<Object> objectStack) throws IOException
SerializerBase
deserializeUnknownHeader
in class SerializerBase
IOException
protected <T> T createInstanceSkippinkConstructor(Class<T> clazz) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException
public boolean hasUnsavedChanges()
public void save(Engine e)
public <A,R> void serializerTransformAdd(Fun.Function1<A,R> beforeSerialization, Fun.Function1<R,A> afterDeserialization)
beforeSerialization
- transform called on all object before they are serializedafterDeserialization
- transform called on all object after they are serializedpublic <A,R> void serializerTransformRemove(Fun.Function1<A,R> beforeSerialization, Fun.Function1<R,A> afterDeserialization)
beforeSerialization
- transform called on all object before they are serializedafterDeserialization
- transform called on all object after they are serializedpublic void serialize(DataOutput out, Object obj) throws IOException
Serializer
serialize
in interface Serializer<Object>
serialize
in class SerializerBase
out
- ObjectOutput to save object intoobj
- Object to serializeIOException
public Object deserialize(DataInput is, int capacity) throws IOException
Serializer
deserialize
in interface Serializer<Object>
deserialize
in class SerializerBase
is
- to read serialized data fromcapacity
- how many bytes are available in DataInput for reading, may be -1 (in streams) or 0 (null).IOException
Copyright © 2017. All rights reserved.