Example usage for com.google.gson JsonSerializer interface-usage

List of usage examples for com.google.gson JsonSerializer interface-usage

Introduction

In this page you can find the example usage for com.google.gson JsonSerializer interface-usage.

Usage

From source file com.google.gwtjsonrpc.server.SqlDateDeserializer.java

public class SqlDateDeserializer implements JsonDeserializer<java.sql.Date>, JsonSerializer<java.sql.Date> {
    public java.sql.Date deserialize(final JsonElement json, final Type typeOfT,
            final JsonDeserializationContext context) throws JsonParseException {
        if (json.isJsonNull()) {
            return null;
        }

From source file com.google.gwtjsonrpc.server.SqlTimestampDeserializer.java

public class SqlTimestampDeserializer
        implements JsonDeserializer<java.sql.Timestamp>, JsonSerializer<java.sql.Timestamp> {
    private static final TimeZone UTC = TimeZone.getTimeZone("UTC");

    public java.sql.Timestamp deserialize(final JsonElement json, final Type typeOfT,
            final JsonDeserializationContext context) throws JsonParseException {

From source file com.google.mr4c.serialize.json.DocumentSerializer.java

/*package*/ class DocumentSerializer implements JsonSerializer<Document>, JsonDeserializer<Document> {
    public Document deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
            throws JsonParseException {
        return new Document(json);
    }

From source file com.google.nigori.common.TypeAdapterByteString.java

public class TypeAdapterByteString implements JsonSerializer<ByteString>, JsonDeserializer<ByteString> {

    @Override
    public JsonElement serialize(ByteString src, Type typeOfSrc, JsonSerializationContext context) {
        return context.serialize(new String(Base64.encodeBase64(src.toByteArray())));
    }

From source file com.google.nigori.common.TypeAdapterProtobuf.java

/**
 * Gson type adapter for protocol buffers
 *
 * @author Inderjeet Singh
 */
public class TypeAdapterProtobuf implements JsonSerializer<GeneratedMessage>, JsonDeserializer<GeneratedMessage> {

From source file com.google.wave.api.impl.ElementGsonAdaptor.java

/**
 * Gson adaptor to serialize and deserialize {@link Element}.
 *
 * @author mprasetya@google.com (Marcel Prasetya)
 */
public class ElementGsonAdaptor implements JsonDeserializer<Element>, JsonSerializer<Element> {

From source file com.google.wave.api.impl.EventMessageBundleGsonAdaptor.java

/**
 * Gson adaptor to serialize and deserialize {@link EventMessageBundle}.
 *
 * @author douwe@google.com (Douwe Osinga)
 */
public class EventMessageBundleGsonAdaptor implements InstanceCreator<EventMessageBundle>,

From source file com.google.wave.api.impl.JsonRpcResponseGsonAdaptor.java

/**
 * Custom serializer and deserializer that serializes and deserializes a
 * {@link JsonRpcResponse}.
 *
 * @author mprasetya@google.com (Marcel Prasetya)
 */

From source file com.google.wave.api.impl.OperationRequestGsonAdaptor.java

/**
 * Custom serializer and deserializer that serializes and deserializes an
 * {@link OperationRequest}.
 *
 * @author mprasetya@google.com (Marcel Prasetya)
 */

From source file com.gs.reladomo.serial.gson.ExampleReladomoGsonSerializer.java

public class ExampleReladomoGsonSerializer<T extends MithraObject> implements JsonSerializer<T> {

    @Override
    public JsonElement serialize(T t, Type type, JsonSerializationContext gsonContext) {
        RelatedFinder finder = t.zGetPortal().getFinder();
        GsonReladomoSerialWriter writer = new GsonReladomoSerialWriter();