public abstract class AbstractCodec extends java.lang.Object implements ITraverseProcessor, IDecoderHandler
Constructor and Description |
---|
AbstractCodec() |
Modifier and Type | Method and Description |
---|---|
boolean |
canReference(java.lang.Object object,
java.lang.Class<?> clazz,
IEncodingContext ec)
Test if the codec allows referencing.
|
abstract java.lang.Object |
createObject(java.lang.Class<?> clazz,
IDecodingContext context)
Creates the object during decoding.
|
java.lang.Object |
decode(java.lang.Class<?> clazz,
IDecodingContext context)
Decodes an object.
|
java.lang.Object |
decodeSubObjects(java.lang.Object object,
java.lang.Class<?> clazz,
IDecodingContext context)
Decodes and adds sub-objects during decoding.
|
abstract java.lang.Object |
encode(java.lang.Object object,
java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
Traverser traverser,
java.util.Map<java.lang.Object,java.lang.Object> traversed,
boolean clone,
IEncodingContext ec)
Encode the object.
|
abstract boolean |
isApplicable(java.lang.Class<?> clazz)
Tests if the decoder can decode the class.
|
boolean |
isApplicable(java.lang.Object object,
java.lang.reflect.Type type,
boolean clone,
java.lang.ClassLoader targetcl)
Test if the processor is applicable.
|
java.lang.Object |
process(java.lang.Object object,
java.lang.reflect.Type type,
java.util.List<ITraverseProcessor> processors,
Traverser traverser,
java.util.Map<java.lang.Object,java.lang.Object> traversed,
boolean clone,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Process an object.
|
void |
recordKnownDecodedObject(java.lang.Object object,
IDecodingContext context)
Record object as known during decoding, allows different behavior if needed.
|
protected java.lang.Object |
runPreProcessors(java.lang.Object object,
java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
Traverser traverser,
java.util.Map<java.lang.Object,java.lang.Object> traversed,
boolean clone,
java.lang.Object context)
Runs the preprocessors.
|
public java.lang.Object process(java.lang.Object object, java.lang.reflect.Type type, java.util.List<ITraverseProcessor> processors, Traverser traverser, java.util.Map<java.lang.Object,java.lang.Object> traversed, boolean clone, java.lang.ClassLoader targetcl, java.lang.Object context)
process
in interface ITraverseProcessor
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.protected java.lang.Object runPreProcessors(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, Traverser traverser, java.util.Map<java.lang.Object,java.lang.Object> traversed, boolean clone, java.lang.Object context)
public boolean canReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)
object
- The object.clazz
- The class.ec
- The encoding context.public abstract java.lang.Object encode(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, Traverser traverser, java.util.Map<java.lang.Object,java.lang.Object> traversed, boolean clone, IEncodingContext ec)
public java.lang.Object decode(java.lang.Class<?> clazz, IDecodingContext context)
decode
in interface IDecoderHandler
clazz
- The class of the object.context
- The decoding context.public abstract java.lang.Object createObject(java.lang.Class<?> clazz, IDecodingContext context)
clazz
- The class of the object.context
- The decoding context.public void recordKnownDecodedObject(java.lang.Object object, IDecodingContext context)
public java.lang.Object decodeSubObjects(java.lang.Object object, java.lang.Class<?> clazz, IDecodingContext context)
object
- The instantiated object.clazz
- The class of the object.context
- The decoding context.public boolean isApplicable(java.lang.Object object, java.lang.reflect.Type type, boolean clone, java.lang.ClassLoader targetcl)
isApplicable
in interface ITraverseProcessor
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.public abstract boolean isApplicable(java.lang.Class<?> clazz)
isApplicable
in interface IDecoderHandler
clazz
- The class.