Package jadex.serialization
Class SerializationServices
java.lang.Object
jadex.serialization.SerializationServices
- All Implemented Interfaces:
ISerializationServices
todo: make one service/helper for all components
Functionality for managing serialization.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Default serializer.protected static SerializationServices
Singleton instance.protected List
<jadex.common.transformation.traverser.ITraverseProcessor> Postprocessors for decoding.protected List
<jadex.common.transformation.traverser.ITraverseProcessor> Preprocessors for encoding.protected ISerializer[]
All available serializers -
Method Summary
Modifier and TypeMethodDescriptionList
<jadex.common.transformation.traverser.ITraverseProcessor> Create the preprocessors.List
<jadex.common.transformation.traverser.ITraverseProcessor> decode
(InputStream is, ClassLoader cl) Decodes/deserializes an object.void
encode
(OutputStream os, ClassLoader cl, Object obj) Encodes/serializes an object for a particular receiver.static final SerializationServices
get()
Gets a singleton instance.List
<jadex.common.transformation.traverser.ITraverseProcessor> Get the clone processors.List
<jadex.common.transformation.traverser.ITraverseProcessor> Gets the post-processors for decoding a received message.List
<jadex.common.transformation.traverser.ITraverseProcessor> Gets the pre-processors for encoding a received message.getSerializer
(int id) Returns a serializer per id.Returns all serializers.Get the string converters (can convert to and from string, possibly only for some types).jadex.common.transformation.traverser.ITraverseProcessor[]
Gets the post-processors for decoding a received message.jadex.common.transformation.traverser.ITraverseProcessor[]
Gets the pre-processors for encoding a received message.boolean
isLocalReference
(Object object) Test if an object has reference semantics.boolean
isRemoteObject
(Object target) Test if an object is a remote object.
-
Field Details
-
defaultserializer
protected int defaultserializerDefault serializer. -
serializers
All available serializers -
preprocessors
Preprocessors for encoding. -
postprocessors
Postprocessors for decoding. -
instance
Singleton instance.
-
-
Method Details
-
get
Gets a singleton instance.- Returns:
- Instance.
-
encode
Encodes/serializes an object for a particular receiver.- Specified by:
encode
in interfaceISerializationServices
- Parameters:
os
- OutputStream to write the object.cl
- The classloader used for encoding.obj
- Object to be encoded.
-
decode
Decodes/deserializes an object.- Specified by:
decode
in interfaceISerializationServices
- 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
Returns all serializers.- Specified by:
getSerializers
in interfaceISerializationServices
- Parameters:
platform
- Sending platform.- Returns:
- Serializers.
-
getSerializer
Returns a serializer per id.- Specified by:
getSerializer
in interfaceISerializationServices
- Parameters:
id
- The id.- Returns:
- The serializer.
-
getPreprocessors
Gets the pre-processors for encoding a received message.- Specified by:
getPreprocessors
in interfaceISerializationServices
-
getPostprocessors
Gets the post-processors for decoding a received message.- Specified by:
getPostprocessors
in interfaceISerializationServices
-
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
-
createPostprocessors
Create the preprocessors. -
isLocalReference
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 interfaceISerializationServices
-
isRemoteObject
Test if an object is a remote object.- Specified by:
isRemoteObject
in interfaceISerializationServices
-
getCloneProcessors
Get the clone processors.- Specified by:
getCloneProcessors
in interfaceISerializationServices
- Returns:
- The clone processors.
-
getStringConverters
Get the string converters (can convert to and from string, possibly only for some types).- Specified by:
getStringConverters
in interfaceISerializationServices
- Returns:
- The converters.
-