omq.common.util.Serializers

## Class GsonImp

- java.lang.Object
- - omq.common.util.Serializers.GsonImp

- All Implemented Interfaces:
    ISerializer

      public class GsonImp
      extends java.lang.Object
      implements ISerializer

  Json serialize implementation. It uses the Gson libraries.
  Author:
    Sergi Toda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GsonImp()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Request` | `deserializeRequest(byte[] bytes, RemoteObject obj)` Deserialize a Request
    `Response` | `deserializeResponse(byte[] bytes, java.lang.Class<?> type)` Deserialize a Response
    `byte[]` | `serialize(java.lang.Object obj)` Serialize

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GsonImp

          public GsonImp()

  - ### Method Detail

    - #### serialize

          public byte[] serialize(java.lang.Object obj)
                           throws SerializerException

      Description copied from interface: `ISerializer`
      Serialize
      Specified by:
        `serialize` in interface `ISerializer`
      Parameters:
        `obj` - - object to serialize
      Returns:
        objectSerialized
      Throws:
        `SerializerException` - - If the serialization failed

    - #### deserializeRequest

          public Request deserializeRequest(byte[] bytes,
                                   RemoteObject obj)
                                     throws SerializerException

      Description copied from interface: `ISerializer`
      Deserialize a Request
      Specified by:
        `deserializeRequest` in interface `ISerializer`
      Parameters:
        `bytes` - - serialized request
        `obj` - - remoteObject which is receiving requests
      Returns:
        request
      Throws:
        `SerializerException` - - If the serialization failed

    - #### deserializeResponse

          public Response deserializeResponse(byte[] bytes,
                                     java.lang.Class<?> type)
                                       throws SerializerException

      Description copied from interface: `ISerializer`
      Deserialize a Response
      Specified by:
        `deserializeResponse` in interface `ISerializer`
      Parameters:
        `bytes` - serialized response
        `type` - - return type expected
      Returns:
        response
      Throws:
        `SerializerException` - - If the serialization failed