Class SerializableTranscoder

All Implemented Interfaces:

public class SerializableTranscoder extends Object implements Transcoder
This transcoder allows to serialize and deserialize objects if they implement the Serializable interface.

Please note that this transcoder is NOT turning the value into a JSON representation, rather it is using the java object serialization which will look to the server like an opaque binary blob. It is useful though if you want to store and retrieve arbitrary java objects and use couchbase as a cache for them.

  • Field Details

  • Method Details

    • encode

      public Transcoder.EncodedValue encode(Object input)
      Description copied from interface: Transcoder
      Encodes the given input into the wire representation based on the data format.
      Specified by:
      encode in interface Transcoder
      input - the input object to encode.
      the encoded wire representation of the payload.
    • decode

      public <T> T decode(Class<T> target, byte[] input, int flags)
      Description copied from interface: Transcoder
      Decodes the wire representation into the entity based on the data format.
      Specified by:
      decode in interface Transcoder
      Type Parameters:
      T - the generic type used for the decoding target.
      target - the target type to decode.
      input - the wire representation to decode.
      flags - the flags on the wire
      the decoded entity.