Package jadex.binary
Class NumberCodec
- java.lang.Object
-
- jadex.binary.AbstractCodec
-
- jadex.binary.NumberCodec
-
- All Implemented Interfaces:
IDecoderHandler
,ITraverseProcessor
public class NumberCodec extends AbstractCodec
Codec for encoding and decoding numbers (short, integer, float, etc.), boolean values and char values.
-
-
Field Summary
Fields Modifier and Type Field Description static NumberCodec
INSTANCE
Default Instanceprotected static java.util.Set<java.lang.Class<?>>
TYPES
The types this processor can handle.
-
Constructor Summary
Constructors Constructor Description NumberCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)
Prevent references for primitive-wrapped types.java.lang.Object
createObject(java.lang.Class<?> clazz, IDecodingContext context)
Creates the object during decoding.java.lang.Object
encode(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> preprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, Traverser traverser, java.lang.ClassLoader targetcl, IEncodingContext ec)
Encode the object.boolean
isApplicable(java.lang.Class<?> clazz)
Tests if the decoder can decode the class.void
recordKnownDecodedObject(java.lang.Object object, IDecodingContext context)
References handling not needed.-
Methods inherited from class jadex.binary.AbstractCodec
decode, decodeSubObjects, isApplicable, isFixedFrame, process
-
-
-
-
Field Detail
-
INSTANCE
public static final NumberCodec INSTANCE
Default Instance
-
TYPES
protected static final java.util.Set<java.lang.Class<?>> TYPES
The types this processor can handle.
-
-
Method Detail
-
isApplicable
public boolean isApplicable(java.lang.Class<?> clazz)
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
public java.lang.Object createObject(java.lang.Class<?> clazz, IDecodingContext context)
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
public void recordKnownDecodedObject(java.lang.Object object, IDecodingContext context)
References handling not needed.- Overrides:
recordKnownDecodedObject
in classAbstractCodec
-
encode
public java.lang.Object encode(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> preprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, Traverser traverser, java.lang.ClassLoader targetcl, IEncodingContext ec)
Encode the object.- Specified by:
encode
in classAbstractCodec
-
canReference
public boolean canReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)
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.
-
-