Class JadexJsonSerializer
- java.lang.Object
- 
- jadex.platform.service.serialization.serializers.JadexJsonSerializer
 
- 
- All Implemented Interfaces:
- ISerializer,- IStringConverter
 
 public class JadexJsonSerializer extends java.lang.Object implements ISerializer, IStringConverter The Jadex JSON serializer. Codec supports parallel calls of multiple concurrent clients (no method synchronization necessary). Converts object -> byte[] and byte[] -> object.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static classJadexJsonSerializer.JsonByteArrayReadProcessorprotected static classJadexJsonSerializer.JsonByteArrayWriteProcessor
 - 
Field SummaryFields Modifier and Type Field Description protected booleanDEBUGThe debug flag.java.util.List<ITraverseProcessor>readprocsThe read processors.static intSERIALIZER_IDThe serializer id.static java.lang.StringTYPEjava.util.List<ITraverseProcessor>writeprocsThe write processors.- 
Fields inherited from interface jadex.commons.transformation.IStringConverterTYPE_BASIC, TYPE_JSON, TYPE_XML
 
- 
 - 
Constructor SummaryConstructors Constructor Description JadexJsonSerializer()Create a new serializer.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProcessor(ITraverseProcessor read, ITraverseProcessor write)Add a read/write processor pair.java.lang.StringconvertObject(java.lang.Object val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.Object context)Convert an object to a string.java.lang.ObjectconvertString(java.lang.String val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.Object context)Convert a string to an object.java.lang.Objectdecode(byte[] bytes, java.lang.ClassLoader classloader, ITraverseProcessor[] postprocs, IErrorReporter rep, java.lang.Object usercontext)Decode an object.java.lang.Objectdecode(java.io.InputStream is, java.lang.ClassLoader classloader, ITraverseProcessor[] postprocs, IErrorReporter rep, java.lang.Object usercontext)Decode an object.byte[]encode(java.lang.Object val, java.lang.ClassLoader classloader, ITraverseProcessor[] preprocs, java.lang.Object usercontext)Encode data with the serializer.intgetSerializerId()Get the serializer id.java.lang.StringgetType()Get the type of string that can be processed (xml, json, plain).booleanisSupportedType(java.lang.Class<?> clazz)Test if the type can be converted.
 
- 
- 
- 
Field Detail- 
SERIALIZER_IDpublic static final int SERIALIZER_ID The serializer id.- See Also:
- Constant Field Values
 
 - 
TYPEpublic static final java.lang.String TYPE - See Also:
- Constant Field Values
 
 - 
DEBUGprotected boolean DEBUG The debug flag.
 - 
writeprocspublic java.util.List<ITraverseProcessor> writeprocs The write processors.
 - 
readprocspublic java.util.List<ITraverseProcessor> readprocs The read processors.
 
- 
 - 
Method Detail- 
getSerializerIdpublic int getSerializerId() Get the serializer id.- Specified by:
- getSerializerIdin interface- ISerializer
- Returns:
- The serializer id.
 
 - 
encodepublic byte[] encode(java.lang.Object val, java.lang.ClassLoader classloader, ITraverseProcessor[] preprocs, java.lang.Object usercontext)Encode data with the serializer.- Specified by:
- encodein interface- ISerializer
- Parameters:
- val- The value.
- classloader- The classloader.
- preproc- The encoding preprocessors.
- Returns:
- The encoded object.
 
 - 
decodepublic java.lang.Object decode(byte[] bytes, java.lang.ClassLoader classloader, ITraverseProcessor[] postprocs, IErrorReporter rep, java.lang.Object usercontext)Decode an object.- Specified by:
- decodein interface- ISerializer
- Parameters:
- bytes- The value bytes as byte array or input stream.
- Returns:
- The decoded object.
- Throws:
- java.io.IOException
 
 - 
decodepublic java.lang.Object decode(java.io.InputStream is, java.lang.ClassLoader classloader, ITraverseProcessor[] postprocs, IErrorReporter rep, java.lang.Object usercontext)Decode an object.- Specified by:
- decodein interface- ISerializer
- Returns:
- The decoded object.
- Throws:
- java.io.IOException
 
 - 
convertStringpublic java.lang.Object convertString(java.lang.String val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.Object context)Convert a string to an object.- Specified by:
- convertStringin interface- IStringConverter
- Parameters:
- val- The string.
- type- The target type.
- context- The context.
- Returns:
- The object.
 
 - 
convertObjectpublic java.lang.String convertObject(java.lang.Object val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.Object context)Convert an object to a string.- Specified by:
- convertObjectin interface- IStringConverter
- Parameters:
- val- The object.
- type- The encoding type.
- context- The context.
- Returns:
- The object.
 
 - 
getTypepublic java.lang.String getType() Get the type of string that can be processed (xml, json, plain).- Specified by:
- getTypein interface- IStringConverter
- Returns:
- The object.
 
 - 
addProcessorpublic void addProcessor(ITraverseProcessor read, ITraverseProcessor write) Add a read/write processor pair.
 - 
isSupportedTypepublic boolean isSupportedType(java.lang.Class<?> clazz) Test if the type can be converted.- Specified by:
- isSupportedTypein interface- IStringConverter
- Parameters:
- clazz- The class.
- Returns:
- True if can be converted.
 
 
- 
 
-