Class JadexBasicTypeSerializer

java.lang.Object
jadex.serialization.serializers.JadexBasicTypeSerializer
All Implemented Interfaces:
jadex.common.transformation.IStringConverter, ISerializer

public class JadexBasicTypeSerializer extends Object implements ISerializer, jadex.common.transformation.IStringConverter
Serializer impl for converting basic types including Jadex specific ones like ComponentIdentifier etc.
  • Field Details

    • SERIALIZER_ID

      public static final int SERIALIZER_ID
      The serializer id.
      See Also:
    • TYPE

      public static final String TYPE
      See Also:
    • DEBUG

      protected boolean DEBUG
      The debug flag.
    • converter

      protected jadex.common.transformation.BasicTypeConverter converter
  • Constructor Details

    • JadexBasicTypeSerializer

      public JadexBasicTypeSerializer()
      The basic type converter.
  • Method Details

    • getSerializerId

      public int getSerializerId()
      Get the serializer id.
      Specified by:
      getSerializerId in interface ISerializer
      Returns:
      The serializer id.
    • encode

      public void encode(OutputStream os, Object val, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] preprocs, Object usercontext)
      Encode data with the serializer.
      Specified by:
      encode in interface ISerializer
      Parameters:
      os - The output stream for writing.
      val - The value.
      classloader - The classloader.
      preproc - The encoding preprocessors.
    • decode

      public Object decode(byte[] bytes, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep, Object usercontext)
      Decode an object.
      Returns:
      The decoded object.
      Throws:
      IOException
    • decode

      public Object decode(InputStream is, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep, Object usercontext)
      Decode an object.
      Specified by:
      decode in interface ISerializer
      Returns:
      The decoded object.
      Throws:
      IOException
    • convertString

      public Object convertString(String val, Class<?> type, ClassLoader cl, Object context)
      Convert a string to an object.
      Specified by:
      convertString in interface jadex.common.transformation.IStringConverter
      Parameters:
      val - The string.
      type - The target type.
      context - The context.
      Returns:
      The object.
    • convertObject

      public String convertObject(Object val, Class<?> type, ClassLoader cl, Object context)
      Convert an object to a string.
      Specified by:
      convertObject in interface jadex.common.transformation.IStringConverter
      Parameters:
      val - The object.
      type - The encoding type.
      context - The context.
      Returns:
      The object.
    • getType

      public String getType()
      Get the type of string that can be processed (xml, json, plain).
      Specified by:
      getType in interface jadex.common.transformation.IStringConverter
      Returns:
      The object.
    • isSupportedType

      public boolean isSupportedType(Class<?> clazz)
      Test if the type can be converted.
      Specified by:
      isSupportedType in interface jadex.common.transformation.IStringConverter
      Parameters:
      clazz - The class.
      Returns:
      True if can be converted.