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.tethrnet.manage.util.SessionOutputSerializer.java

public class SessionOutputSerializer implements JsonSerializer<Object> {
    @Override
    public JsonElement serialize(Object src, Type typeOfSrc, JsonSerializationContext context) {
        JsonObject object = new JsonObject();
        if (typeOfSrc.equals(AuditWrapper.class)) {
            AuditWrapper auditWrapper = (AuditWrapper) src;

From source file com.textcontrol.reportingcloud.gson.MergeBodySerializer.java

/**
 * Needed by GSON to serialize {@link com.textcontrol.reportingcloud.MergeBody} objects to
 * JSON.
 *
 * @author Thorsten Kummerow
 */

From source file com.textcontrol.reportingcloud.gson.MergeSettingsSerializer.java

/**
 * Needed by GSON to serialize {@link com.textcontrol.reportingcloud.MergeSettings} objects to
 * JSON.
 *
 * @author Thorsten Kummerow
 */

From source file com.thoughtworks.go.plugin.access.configrepo.codec.ArtifactTypeAdapter.java

public class ArtifactTypeAdapter extends TypeAdapter
        implements JsonDeserializer<com.thoughtworks.go.plugin.access.configrepo.contract.CRArtifact>,
        JsonSerializer<com.thoughtworks.go.plugin.access.configrepo.contract.CRArtifact> {
    private static final String TYPE = "type";

    @Override

From source file com.thoughtworks.go.plugin.configrepo.codec.ArtifactTypeAdapter.java

public class ArtifactTypeAdapter extends TypeAdapter
        implements JsonDeserializer<CRArtifact>, JsonSerializer<CRArtifact> {
    private static final String TYPE = "type";

    @Override
    public CRArtifact deserialize(JsonElement json, Type type, JsonDeserializationContext context)

From source file com.thoughtworks.go.plugin.configrepo.codec.MaterialTypeAdapter.java

public class MaterialTypeAdapter extends TypeAdapter
        implements JsonDeserializer<CRMaterial>, JsonSerializer<CRMaterial> {

    private static final String TYPE = "type";

    @Override

From source file com.thoughtworks.go.plugin.configrepo.codec.TaskTypeAdapter.java

public class TaskTypeAdapter extends TypeAdapter implements JsonDeserializer<CRTask>, JsonSerializer<CRTask> {
    private static final String TYPE = "type";

    @Override
    public CRTask deserialize(JsonElement json, Type type, JsonDeserializationContext context)
            throws JsonParseException {

From source file com.threewks.thundr.json.DateTimeTypeConvertor.java

public class DateTimeTypeConvertor implements JsonSerializer<DateTime>, JsonDeserializer<DateTime> {
    @Override
    public JsonElement serialize(DateTime src, Type srcType, JsonSerializationContext context) {
        return new JsonPrimitive(src.toString());
    }

From source file com.threewks.thundr.json.DateTimeZoneTypeConvertor.java

public class DateTimeZoneTypeConvertor implements JsonSerializer<DateTimeZone>, JsonDeserializer<DateTimeZone> {
    @Override
    public JsonElement serialize(DateTimeZone src, Type srcType, JsonSerializationContext context) {
        return new JsonPrimitive(src.getID());
    }

From source file com.tomeokin.lspush.data.support.ImageTypeConverter.java

public class ImageTypeConverter implements JsonSerializer<Image>, JsonDeserializer<Image> {
    private Gson gson;

    public ImageTypeConverter(Gson gson) {
        this.gson = gson;
    }