omq.common.util

## Class Serializer

- java.lang.Object
- - omq.common.util.Serializer

-     public class Serializer
      extends java.lang.Object

  Serializer enables to serialize the requests and the responses of the remoteObjects. This class is used to have the same serializer object a not to create new instances every time they are needed.
  Author:
    Sergi Toda

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `GSON`
    `static java.lang.String` | `JAVA`
    `static java.lang.String` | `KRYO`
    `ISerializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Serializer(java.util.Properties env)`

  - ### Method Summary

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

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

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

- - ### Field Detail

    - #### KRYO

          public static final java.lang.String KRYO

      See Also:
        Constant Field Values

    - #### JAVA

          public static final java.lang.String JAVA

      See Also:
        Constant Field Values

    - #### GSON

          public static final java.lang.String GSON

      See Also:
        Constant Field Values

    - #### serializer

          public ISerializer serializer

  - ### Constructor Detail

    - #### Serializer

          public Serializer(java.util.Properties env)

  - ### Method Detail

    - #### getInstance

          public ISerializer getInstance()
                                  throws SerializerException

      Throws:
        `SerializerException`

    - #### getInstance

          public ISerializer getInstance(java.lang.String type)
                                  throws SerializerException

      Throws:
        `SerializerException`

    - #### serialize

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

      Throws:
        `SerializerException`

    - #### serialize

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

      Throws:
        `SerializerException`

    - #### deserializeRequest

          public Request deserializeRequest(java.lang.String type,
                                   byte[] bytes,
                                   RemoteObject obj)
                                     throws SerializerException

      Throws:
        `SerializerException`

    - #### deserializeResponse

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

      Throws:
        `SerializerException`