Package jadex.binary
Class BeanCodec
java.lang.Object
jadex.binary.AbstractCodec
jadex.binary.BeanCodec
- All Implemented Interfaces:
IDecoderHandler
,jadex.common.transformation.traverser.ITraverseProcessor
- Direct Known Subclasses:
SimpleDateFormatCodec
Codec for encoding and decoding Java Beans.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected jadex.common.transformation.traverser.IBeanIntrospector
Bean introspector for inspecting beans.protected static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateObject
(Class<?> clazz, IDecodingContext context) Creates the object during decoding.decodeSubObjects
(Object object, Class<?> clazz, IDecodingContext context) Decodes and adds sub-objects during decoding.encode
(Object object, Class<?> clazz, List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, jadex.common.transformation.traverser.Traverser traverser, ClassLoader targetcl, IEncodingContext ec) Encode the object.boolean
isApplicable
(Class<?> clazz) Tests if the decoder can decode the class.boolean
isApplicable
(Object object, Type type, boolean clone, ClassLoader targetcl) Test if the processor is applicable.static void
readBeanProperties
(Object object, Class clazz, IDecodingContext context, jadex.common.transformation.traverser.IBeanIntrospector intro) static void
writeBeanProperties
(Object object, Class<?> clazz, List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.traverser.Traverser traverser, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, IEncodingContext ec, jadex.common.transformation.traverser.IBeanIntrospector intro) Methods inherited from class jadex.binary.AbstractCodec
canReference, decode, isApplicable, isFixedFrame, process, recordKnownDecodedObject
-
Field Details
-
INTROSPECTOR_CACHE_SIZE
protected static final int INTROSPECTOR_CACHE_SIZE- See Also:
-
intro
protected jadex.common.transformation.traverser.IBeanIntrospector introBean introspector for inspecting beans.
-
-
Constructor Details
-
BeanCodec
public BeanCodec()
-
-
Method Details
-
isApplicable
Tests if the decoder can decode the class.- Specified by:
isApplicable
in interfaceIDecoderHandler
- Specified by:
isApplicable
in classAbstractCodec
- Parameters:
clazz
- The class.- Returns:
- True, if the decoder can decode this class.
-
createObject
Creates the object during decoding.- Specified by:
createObject
in classAbstractCodec
- Parameters:
clazz
- The class of the object.context
- The decoding context.- Returns:
- The created object.
-
decodeSubObjects
Decodes and adds sub-objects during decoding.- Overrides:
decodeSubObjects
in classAbstractCodec
- Parameters:
object
- The instantiated object.clazz
- The class of the object.context
- The decoding context.- Returns:
- The finished object.
-
isApplicable
Test if the processor is applicable.- Parameters:
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.- Returns:
- True, if is applicable.
-
encode
public Object encode(Object object, Class<?> clazz, List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, jadex.common.transformation.traverser.Traverser traverser, ClassLoader targetcl, IEncodingContext ec) Encode the object.- Specified by:
encode
in classAbstractCodec
-
writeBeanProperties
public static void writeBeanProperties(Object object, Class<?> clazz, List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.traverser.Traverser traverser, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, IEncodingContext ec, jadex.common.transformation.traverser.IBeanIntrospector intro) -
readBeanProperties
public static void readBeanProperties(Object object, Class clazz, IDecodingContext context, jadex.common.transformation.traverser.IBeanIntrospector intro)
-