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 Summary
Modifier and TypeMethodDescriptiondecode
(String source, CouchbaseStorable target) Decodes the target format into aCouchbaseDocument
<T> T
decodeFragment
(String source, Class<T> target) Decodes an ad-hoc JSON object into a corresponding "case" class.encode
(CouchbaseStorable source) Encodes a JSON String into the target format.
-
Method Details
-
encode
Encodes a JSON String into the target format.- Parameters:
source
- the source contents to encode.- Returns:
- the encoded document representation.
-
decode
Decodes the target format into aCouchbaseDocument
- Parameters:
source
- the source formatted document.target
- the target of the populated data.- Returns:
- a properly populated document to work with.
-
decodeFragment
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.
-