public final class OAObjectSerializer<TYPE> extends Object implements Serializable
OAObject serialization will then call the serializer to determine which reference properties should be included in the serialization.
Note: this is final so that it can not be subclassed, which would cause serialization problems when it tries to recreate with the new subclass instance - remember this is a wrapper that is serialized and transported, then unserialized (trust me, painful lessons here ha) Use setCallback(..) to be able to control each object's setting as it is serialized.
Modifier and Type | Field and Description |
---|---|
static boolean |
bReadId |
int |
dupCount |
int |
newCount |
Constructor and Description |
---|
OAObjectSerializer(TYPE object,
boolean bCompress) |
OAObjectSerializer(TYPE object,
boolean bCompress,
boolean bAllReferences)
Used to serialize an object.
|
OAObjectSerializer(TYPE object,
boolean bCompress,
OAObjectSerializerCallback callback) |
OAObjectSerializer(TYPE object,
Object extraObject,
boolean bCompress,
OAObjectSerializerCallback callback) |
Modifier and Type | Method and Description |
---|---|
protected void |
excludeAllProperties() |
void |
excludedClasses(Class... classes) |
protected void |
excludeProperties(String[] props) |
int |
getClientId() |
long |
getCompressedWritten() |
Object |
getExtraObject() |
int |
getId() |
int |
getLevelsDeep()
Number of objects currently being serialized.
|
int |
getMax() |
int |
getMaxSize() |
TYPE |
getObject()
The object that is being wrapped.
|
protected Object |
getPreviousObject() |
Object |
getReferenceValueToSend(Object obj) |
protected Object |
getStackObject(int pos) |
protected int |
getStackSize() |
int |
getTotalObjectsWritten() |
boolean |
hasReachedMax() |
protected void |
includeAllProperties() |
protected void |
includeProperties(String[] props) |
static void |
main(String[] args) |
void |
setCallback(OAObjectSerializerCallback callback)
Used to dynamically determine which objects are serialized.
|
void |
setClientId(int id) |
void |
setExcludedReferences(Class... classes)
Classes that should not be serialized.
|
void |
setExtraObject(Object extraObject) |
void |
setId(int id) |
void |
setMax(int max)
Max number of objects to serialize.
|
void |
setMaxSize(int maxSize) |
protected boolean |
shouldSerializeReference(OAObject oaObj,
String propertyName,
Object obj)
Called by OAObjectSerializeDelegate._writeObject() to determine if an object reference property
should be included for serialization.
|
protected boolean |
shouldSerializeReference(OAObject oaObj,
String propertyName,
Object obj,
OALinkInfo linkInfo) |
public static boolean bReadId
public transient int newCount
public transient int dupCount
public OAObjectSerializer(TYPE object, boolean bCompress, OAObjectSerializerCallback callback)
object
- root object to serializecallback
- object that will be called (setupProperties(obj)) for each object that will be serialized, used
to determine which reference properties to include.public OAObjectSerializer(TYPE object, boolean bCompress)
public OAObjectSerializer(TYPE object, Object extraObject, boolean bCompress, OAObjectSerializerCallback callback)
public OAObjectSerializer(TYPE object, boolean bCompress, boolean bAllReferences)
object
- root object to serialize.bCompress
- use compressionbAllReferences
- flag to know if all references or no references should be serialized with object.
see #setExcludedClasses(Class[]) to include reference classes should not be serialized.public void setId(int id)
public int getId()
public void setClientId(int id)
public int getClientId()
public void setExcludedReferences(Class... classes)
public void excludedClasses(Class... classes)
public void setMax(int max)
public int getMax()
public int getTotalObjectsWritten()
public void setMaxSize(int maxSize)
public int getMaxSize()
protected void includeProperties(String[] props)
protected void excludeProperties(String[] props)
protected void includeAllProperties()
protected void excludeAllProperties()
protected int getStackSize()
protected Object getPreviousObject()
protected Object getStackObject(int pos)
public int getLevelsDeep()
protected boolean shouldSerializeReference(OAObject oaObj, String propertyName, Object obj)
protected boolean shouldSerializeReference(OAObject oaObj, String propertyName, Object obj, OALinkInfo linkInfo)
public boolean hasReachedMax()
public long getCompressedWritten()
public TYPE getObject()
public Object getExtraObject()
public void setExtraObject(Object extraObject)
public void setCallback(OAObjectSerializerCallback callback)
callback
- Copyright © 1999–2019 ViaOA. All rights reserved.