|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.SerializerBase
org.mapdb.SerializerPojo
public class SerializerPojo
Serializer which handles POJO, object graphs etc.
| Nested Class Summary | |
|---|---|
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
|
| Nested classes/interfaces inherited from class org.mapdb.SerializerBase |
|---|
SerializerBase.FastArrayList<K>, SerializerBase.Header, SerializerBase.HeaderMapDB, SerializerBase.singletons |
| Nested classes/interfaces inherited from interface org.mapdb.Serializer |
|---|
Serializer.CompressionWrapper<E> |
| Field Summary | |
|---|---|
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
|
| Fields inherited from class org.mapdb.SerializerBase |
|---|
EMPTY_STRING |
| Fields inherited from interface org.mapdb.Serializer |
|---|
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 Summary | |
|---|---|
SerializerPojo(CopyOnWriteArrayList<SerializerPojo.ClassInfo> registered)
|
|
| Method Summary | ||
|---|---|---|
protected void |
assertClassSerializable(Class<?> clazz)
|
|
protected static Class<?> |
classForName(String className)
|
|
boolean |
containsClass(Class<?> clazz)
|
|
protected
|
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 |
|
|
serializerTransformAdd(Fun.Function1<A,R> beforeSerialization,
Fun.Function1<R,A> afterDeserialization)
Add interceptor which may modify all deserialized/serialized objects |
|
|
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)
|
|
| Methods inherited from class org.mapdb.SerializerBase |
|---|
assertSerializable, booleanToByteArray, deserialize, deserializeClass, deserializeMapDB, fixedSize, readBooleanArray, serialize, serializeClass |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Serializer<CopyOnWriteArrayList<SerializerPojo.ClassInfo>> serializer
protected final ReentrantReadWriteLock lock
protected DB db
protected CopyOnWriteArrayList<SerializerPojo.ClassInfo> registered
protected Map<Class<?>,Integer> class2classId
protected Map<Integer,Class<?>> classId2class
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
| Constructor Detail |
|---|
public SerializerPojo(CopyOnWriteArrayList<SerializerPojo.ClassInfo> registered)
| Method Detail |
|---|
protected static Class<?> classForName(String className)
protected void setDb(DB db)
public void registerClass(Class<?> clazz)
throws IOException
IOExceptionprotected boolean usesAdvancedSerialization(Class<?> clazz)
protected void saveClassInfo()
protected ObjectStreamField[] getFields(Class<?> clazz)
protected void assertClassSerializable(Class<?> clazz)
throws NotSerializableException,
InvalidClassException
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 SerializerBaseIOException
protected Object deserializeUnknownHeader(DataInput in,
int head,
SerializerBase.FastArrayList<Object> objectStack)
throws IOException
SerializerBase
deserializeUnknownHeader in class SerializerBaseIOException
protected <T> T createInstanceSkippinkConstructor(Class<T> clazz)
throws NoSuchMethodException,
InvocationTargetException,
IllegalAccessException,
InstantiationException
NoSuchMethodException
InvocationTargetException
IllegalAccessException
InstantiationExceptionpublic 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 serialized
public <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 serialized
public void serialize(DataOutput out,
Object obj)
throws IOException
Serializer
serialize in interface Serializer<Object>serialize in class SerializerBaseout - ObjectOutput to save object intoobj - Object to serialize
IOException
public Object deserialize(DataInput is,
int capacity)
throws IOException
Serializer
deserialize in interface Serializer<Object>deserialize in class SerializerBaseis - to read serialized data fromcapacity - how many bytes are available in DataInput for reading, may be -1 (in streams) or 0 (null).
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||