de.gesellix.couchdb.moshi.MoshiJson Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of couchdb-client Show documentation
Show all versions of couchdb-client Show documentation
A CouchDB client written in Groovy
The newest version!
package de.gesellix.couchdb.moshi;
import com.squareup.moshi.Moshi;
import de.gesellix.couchdb.Json;
import okhttp3.internal.Util;
import okio.Okio;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Map;
public class MoshiJson implements Json {
Moshi moshi;
public MoshiJson() {
this(new Moshi.Builder());
}
public MoshiJson(Moshi.Builder builder) {
this.moshi = builder.build();
}
@Override
public String encodeQueryValue(String key) {
return moshi.adapter(String.class).toJson(key);
}
@Override
public String encodeQueryValue(Collection keys) {
return moshi.adapter(Collection.class).toJson(keys);
}
@Override
public String encodeDocument(Map