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 NumberCodecINSTANCEDefault Instanceprotected static java.util.Set<java.lang.Class<?>>TYPESThe types this processor can handle.
-
Constructor Summary
Constructors Constructor Description NumberCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)Prevent references for primitive-wrapped types.java.lang.ObjectcreateObject(java.lang.Class<?> clazz, IDecodingContext context)Creates the object during decoding.java.lang.Objectencode(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.booleanisApplicable(java.lang.Class<?> clazz)Tests if the decoder can decode the class.voidrecordKnownDecodedObject(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:
isApplicablein interfaceIDecoderHandler- Specified by:
isApplicablein 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:
createObjectin 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:
recordKnownDecodedObjectin 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:
encodein classAbstractCodec
-
canReference
public boolean canReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)Prevent references for primitive-wrapped types.- Overrides:
canReferencein classAbstractCodec- Parameters:
object- The current object.clazz- The class.ec- The encoding context.- Returns:
- True, if a reference has been encoded, false otherwise.
-
-