Interface TranslationService

All Known Implementing Classes:
JacksonTranslationService

public interface TranslationService
Defines a translation service to encode/decode responses into the CouchbaseStorable format.
Author:
Michael Nitschinger
  • Method Details

    • encode

      String encode(CouchbaseStorable source)
      Encodes a JSON String into the target format.
      Parameters:
      source - the source contents to encode.
      Returns:
      the encoded document representation.
    • decode

      CouchbaseStorable decode(String source, CouchbaseStorable target)
      Decodes the target format into a CouchbaseDocument
      Parameters:
      source - the source formatted document.
      target - the target of the populated data.
      Returns:
      a properly populated document to work with.
    • decodeFragment

      <T> T decodeFragment(String source, Class<T> target)
      Decodes an ad-hoc JSON object into a corresponding "case" class.
      Type Parameters:
      T - the target class.
      Parameters:
      source - the JSON for the ad-hoc JSON object (from a N1QL query for instance).
      target - the target class information.
      Returns:
      an ad-hoc instance of the decoded JSON into the corresponding "case" class.