Package jadex.binary
Class NumberCodec
java.lang.Object
jadex.binary.AbstractCodec
jadex.binary.NumberCodec
- All Implemented Interfaces:
IDecoderHandler
,jadex.common.transformation.traverser.ITraverseProcessor
Codec for encoding and decoding numbers (short, integer, float, etc.),
boolean values and char values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NumberCodec
Default InstanceThe types this processor can handle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canReference
(Object object, Class<?> clazz, IEncodingContext ec) Prevent references for primitive-wrapped types.createObject
(Class<?> clazz, IDecodingContext context) Creates the object 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.void
recordKnownDecodedObject
(Object object, IDecodingContext context) References handling not needed.Methods inherited from class jadex.binary.AbstractCodec
decode, decodeSubObjects, isApplicable, isFixedFrame, process
-
Field Details
-
INSTANCE
Default Instance -
TYPES
The types this processor can handle.
-
-
Constructor Details
-
NumberCodec
public NumberCodec()
-
-
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.
-
recordKnownDecodedObject
References handling not needed.- Overrides:
recordKnownDecodedObject
in classAbstractCodec
-
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
-
canReference
Prevent references for primitive-wrapped types.- Overrides:
canReference
in classAbstractCodec
- Parameters:
object
- The current object.clazz
- The class.ec
- The encoding context.- Returns:
- True, if a reference has been encoded, false otherwise.
-