Package jadex.binary
Class AbstractCodec
- java.lang.Object
- 
- jadex.binary.AbstractCodec
 
- 
- All Implemented Interfaces:
- IDecoderHandler,- ITraverseProcessor
 - Direct Known Subclasses:
- ArrayCodec,- BeanCodec,- BigIntegerCodec,- BinaryResponseProcessor,- CalendarCodec,- CertificateCodec,- ClassCodec,- CollectionCodec,- ColorCodec,- CurrencyCodec,- DateCodec,- EnumCodec,- EnumerationCodec,- ImageCodec,- InetAddressCodec,- LocalDateTimeCodec,- LoggingLevelCodec,- LogRecordCodec,- LRUCodec,- MapCodec,- MultiCollectionCodec,- NumberCodec,- OptionalCodec,- RectangleCodec,- StackTraceElementCodec,- StringCodec,- ThrowableCodec,- TimestampCodec,- TupleCodec,- URICodec,- URLCodec,- UUIDCodec
 
 public abstract class AbstractCodec extends java.lang.Object implements ITraverseProcessor, IDecoderHandler 
- 
- 
Constructor SummaryConstructors Constructor Description AbstractCodec()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)Test if the codec allows referencing.abstract java.lang.ObjectcreateObject(java.lang.Class<?> clazz, IDecodingContext context)Creates the object during decoding.java.lang.Objectdecode(java.lang.Class<?> clazz, IDecodingContext context)Decodes an object.java.lang.ObjectdecodeSubObjects(java.lang.Object object, java.lang.Class<?> clazz, IDecodingContext context)Decodes and adds sub-objects during decoding.abstract 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.abstract booleanisApplicable(java.lang.Class<?> clazz)Tests if the decoder can decode the class.booleanisApplicable(java.lang.Object object, java.lang.reflect.Type type, java.lang.ClassLoader targetcl, java.lang.Object context)Test if the processor is applicable.protected booleanisFixedFrame()Declares if the codec should use fixed or variable framing in framing mode.java.lang.Objectprocess(java.lang.Object object, java.lang.reflect.Type type, Traverser traverser, java.util.List<ITraverseProcessor> conversionprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, java.lang.ClassLoader targetcl, java.lang.Object context)Process an object.voidrecordKnownDecodedObject(java.lang.Object object, IDecodingContext context)Record object as known during decoding, allows different behavior if needed.
 
- 
- 
- 
Method Detail- 
processpublic java.lang.Object process(java.lang.Object object, java.lang.reflect.Type type, Traverser traverser, java.util.List<ITraverseProcessor> conversionprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, java.lang.ClassLoader targetcl, java.lang.Object context)Process an object.- Specified by:
- processin interface- ITraverseProcessor
- 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:
- The processed object.
 
 - 
canReferencepublic boolean canReference(java.lang.Object object, java.lang.Class<?> clazz, IEncodingContext ec)Test if the codec allows referencing.- Parameters:
- object- The object.
- clazz- The class.
- ec- The encoding context.
- Returns:
- True, if the codec allows referencing.
 
 - 
encodepublic abstract 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.
 - 
decodepublic java.lang.Object decode(java.lang.Class<?> clazz, IDecodingContext context)Decodes an object.- Specified by:
- decodein interface- IDecoderHandler
- Parameters:
- clazz- The class of the object.
- context- The decoding context.
- Returns:
- The decoded object.
 
 - 
createObjectpublic abstract java.lang.Object createObject(java.lang.Class<?> clazz, IDecodingContext context)Creates the object during decoding.- Parameters:
- clazz- The class of the object.
- context- The decoding context.
- Returns:
- The created object.
 
 - 
recordKnownDecodedObjectpublic void recordKnownDecodedObject(java.lang.Object object, IDecodingContext context)Record object as known during decoding, allows different behavior if needed.
 - 
decodeSubObjectspublic java.lang.Object decodeSubObjects(java.lang.Object object, java.lang.Class<?> clazz, IDecodingContext context)Decodes and adds sub-objects during decoding.- Parameters:
- object- The instantiated object.
- clazz- The class of the object.
- context- The decoding context.
- Returns:
- The finished object.
 
 - 
isApplicablepublic boolean isApplicable(java.lang.Object object, java.lang.reflect.Type type, java.lang.ClassLoader targetcl, java.lang.Object context)Test if the processor is applicable.- Specified by:
- isApplicablein interface- ITraverseProcessor
- 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.
 
 - 
isApplicablepublic abstract boolean isApplicable(java.lang.Class<?> clazz) Tests if the decoder can decode the class.- Specified by:
- isApplicablein interface- IDecoderHandler
- Parameters:
- clazz- The class.
- Returns:
- True, if the decoder can decode this class.
 
 - 
isFixedFrameprotected boolean isFixedFrame() Declares if the codec should use fixed or variable framing in framing mode. Variable framing tends to be more space-efficient especially for small object but can be more costly to encode when the object is larger than 127 bytes. Addendum: Testing seems to suggest that the performance impact is below measuring noise, therefore variable-size framing is now enabled for all codecs. Default is false (variable encoding).- Returns:
- True, if fixed size framing should be used.
 
 
- 
 
-