Class SerializationServices

java.lang.Object
jadex.serialization.SerializationServices
All Implemented Interfaces:
ISerializationServices

public class SerializationServices extends Object implements ISerializationServices
todo: make one service/helper for all components Functionality for managing serialization.
  • Field Details

    • defaultserializer

      protected int defaultserializer
      Default serializer.
    • serializers

      protected ISerializer[] serializers
      All available serializers
    • preprocessors

      protected List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors
      Preprocessors for encoding.
    • postprocessors

      protected List<jadex.common.transformation.traverser.ITraverseProcessor> postprocessors
      Postprocessors for decoding.
    • instance

      protected static volatile SerializationServices instance
      Singleton instance.
  • Method Details

    • get

      public static final SerializationServices get()
      Gets a singleton instance.
      Returns:
      Instance.
    • encode

      public void encode(OutputStream os, ClassLoader cl, Object obj)
      Encodes/serializes an object for a particular receiver.
      Specified by:
      encode in interface ISerializationServices
      Parameters:
      os - OutputStream to write the object.
      cl - The classloader used for encoding.
      obj - Object to be encoded.
    • decode

      public Object decode(InputStream is, ClassLoader cl)
      Decodes/deserializes an object.
      Specified by:
      decode in interface ISerializationServices
      Parameters:
      is - InputStream to read.
      cl - The classloader used for decoding.
      header - The header object if available, null otherwise.
      Returns:
      Object to be encoded.
    • getSerializers

      public ISerializer[] getSerializers()
      Returns all serializers.
      Specified by:
      getSerializers in interface ISerializationServices
      Parameters:
      platform - Sending platform.
      Returns:
      Serializers.
    • getSerializer

      public ISerializer getSerializer(int id)
      Returns a serializer per id.
      Specified by:
      getSerializer in interface ISerializationServices
      Parameters:
      id - The id.
      Returns:
      The serializer.
    • getPreprocessors

      public List<jadex.common.transformation.traverser.ITraverseProcessor> getPreprocessors()
      Gets the pre-processors for encoding a received message.
      Specified by:
      getPreprocessors in interface ISerializationServices
    • getPostprocessors

      public List<jadex.common.transformation.traverser.ITraverseProcessor> getPostprocessors()
      Gets the post-processors for decoding a received message.
      Specified by:
      getPostprocessors in interface ISerializationServices
    • internalGetPreprocessors

      public jadex.common.transformation.traverser.ITraverseProcessor[] internalGetPreprocessors()
      Gets the pre-processors for encoding a received message.
    • internalGetPostprocessors

      public jadex.common.transformation.traverser.ITraverseProcessor[] internalGetPostprocessors()
      Gets the post-processors for decoding a received message.
    • createPreprocessors

      public List<jadex.common.transformation.traverser.ITraverseProcessor> createPreprocessors()
    • createPostprocessors

      public List<jadex.common.transformation.traverser.ITraverseProcessor> createPostprocessors()
      Create the preprocessors.
    • isLocalReference

      public boolean isLocalReference(Object object)
      Test if an object has reference semantics. It is a reference when: - it implements IRemotable - it is an IService, IExternalAccess or IFuture - if the object has used an @Reference annotation at type level - has been explicitly set to be reference
      Specified by:
      isLocalReference in interface ISerializationServices
    • isRemoteObject

      public boolean isRemoteObject(Object target)
      Test if an object is a remote object.
      Specified by:
      isRemoteObject in interface ISerializationServices
    • getCloneProcessors

      public List<jadex.common.transformation.traverser.ITraverseProcessor> getCloneProcessors()
      Get the clone processors.
      Specified by:
      getCloneProcessors in interface ISerializationServices
      Returns:
      The clone processors.
    • getStringConverters

      public Map<String,jadex.common.transformation.IStringConverter> getStringConverters()
      Get the string converters (can convert to and from string, possibly only for some types).
      Specified by:
      getStringConverters in interface ISerializationServices
      Returns:
      The converters.