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 ca.ualberta.cmput301w14t08.geochan.json.ThreadCommentOfflineJsonConverter.java

/**
 * Handles the serialization of a ThreadComment object into JSON format for
 * offline caching.
 * 
 * @author Artem Chikin
 * @author Artem Herasymchuk

From source file ca.ualberta.CMPUT301W15T06.GsonAdapter.java

/**
 * This is an adapter class for <code>Gson</code>, as a subclass of <code>JsonSerializer</code> 
 * and <code>JsonDeserializer</code>. This class is design to let the application use the Gson library.
 * 
 * @author CMPUT301W15T06
 * @see com.google.gson.JsonDeserializationContext

From source file ca.ualberta.cs.drivr.UriSerializer.java

/**
 * A class to use with Gson for serializing/deserializing Uris.
 * <ul>
 *     <li>URL: http://stackoverflow.com/a/27704368</li>
 *     <li>Author: Marco Bonechi</li>
 *     <li>Accessed: November 9, 2016</li>

From source file ca.ualberta.cs.scandaloutraveltracker.mappers.UserMapper.java

/**
 * Helps to serialize a Location object so it can be saved in sharedpreferences
 * @author Team3ScandalouStopwatch
 *
 */
class LocationSerializer implements JsonSerializer<Location> {

From source file ca.ualberta.cs.unter.util.GeoPointConverter.java

/**
 * Serializes and deserializes a GeoPoint
 *
 * It gets serialized to [lon, lat] (e.g. [-67.834062, 46.141129] )
 *
 * It also expects this format when deserializing.

From source file cc.kave.commons.utils.json.DurationConverter.java

public class DurationConverter implements JsonSerializer<Duration>, JsonDeserializer<Duration> {

    @Override
    public JsonElement serialize(Duration duration, Type typeOfSrc, JsonSerializationContext context) {
        LocalTime plus = LocalTime.MIDNIGHT.plus(duration);
        String middle = plus.format(DateTimeFormatter.ofPattern("HH:mm:ss"));

From source file cc.kave.commons.utils.json.EnumDeSerializer.java

public class EnumDeSerializer<T extends Enum<T>> implements JsonSerializer<T>, JsonDeserializer<T> {

    private T[] values;

    private EnumDeSerializer(T[] values) {
        this.values = values;

From source file cc.kave.commons.utils.json.GsonNameDeserializer.java

public class GsonNameDeserializer implements JsonDeserializer<IName>, JsonSerializer<IName> {

    @Override
    public IName deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
            throws JsonParseException {
        String str = json.getAsString();

From source file cc.kave.commons.utils.json.legacy.GsonFileSerializer.java

public class GsonFileSerializer implements JsonSerializer<File> {

    @Override
    public JsonElement serialize(final File src, final Type typeOfSrc, final JsonSerializationContext context) {
        return new JsonPrimitive(src.toString());
    }

From source file cc.kave.commons.utils.json.legacy.GsonNameSerializer.java

public class GsonNameSerializer implements JsonSerializer<ICoReName> {
    @Override
    public JsonElement serialize(final ICoReName src, final Type typeOfSrc,
            final JsonSerializationContext context) {
        return new JsonPrimitive(src.getIdentifier());
    }