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.julauncher.data.mojang.PropertyMapSerializer.java

public class PropertyMapSerializer implements JsonSerializer<PropertyMap> {

    @Override
    public JsonElement serialize(PropertyMap src, Type typeOfSrc, JsonSerializationContext context) {
        JsonObject out = new JsonObject();
        for (String key : src.keySet()) {

From source file com.keybox.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.keydap.sparrow.DateTimeSerializer.java

/**
 * RFC3339 date serializer
 * 
 * @author Kiran Ayyagari (kayyagari@keydap.com)
 */
public class DateTimeSerializer implements JsonSerializer<Date>, JsonDeserializer<Date> {

From source file com.kolich.common.entities.gson.KolichDefaultDateTypeAdapter.java

public final class KolichDefaultDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {

    private final DateFormat format_;

    public KolichDefaultDateTypeAdapter(final DateFormat format) {
        format_ = format;

From source file com.kotcrab.vis.editor.serializer.json.ArrayJsonSerializer.java

/** @author Kotcrab */
public class ArrayJsonSerializer<T> implements JsonSerializer<Array<T>>, JsonDeserializer<Array<T>> {
    public static final String PRIMITIVE_CONTENT = "@content";

    @Override
    public JsonElement serialize(Array<T> array, Type typeOfSrc, JsonSerializationContext context) {

From source file com.kotcrab.vis.editor.serializer.json.AssetComponentSerializer.java

/** @author Kotcrab */
public class AssetComponentSerializer implements JsonSerializer<AssetReference>, JsonDeserializer<AssetReference> {
    @Override
    public JsonElement serialize(AssetReference asset, Type typeOfSrc, JsonSerializationContext context) {
        JsonElement jsonAsset = context.serialize(asset.asset, asset.asset.getClass());
        GsonUtils.appendClassProperty(jsonAsset, asset.asset, context);

From source file com.kotcrab.vis.editor.serializer.json.ClassJsonSerializer.java

/** @author Kotcrab */
public class ClassJsonSerializer implements JsonSerializer<Class<?>>, JsonDeserializer<Class<?>> {
    private ObjectMap<Class<?>, String> classTagMap = new ObjectMap<>();
    private ObjectMap<String, Class<?>> tagClassMap = new ObjectMap<>();

    private ClassLoader classLoader;

From source file com.kotcrab.vis.editor.serializer.json.IntArrayJsonSerializer.java

/** @author Kotcrab */
public class IntArrayJsonSerializer implements JsonSerializer<IntArray>, JsonDeserializer<IntArray> {
    @Override
    public JsonElement serialize(IntArray intArray, Type typeOfSrc, JsonSerializationContext context) {
        JsonArray json = new JsonArray();

From source file com.kotcrab.vis.editor.serializer.json.IntMapJsonSerializer.java

/** @author Kotcrab */
public class IntMapJsonSerializer<T> implements JsonSerializer<IntMap<T>>, JsonDeserializer<IntMap<T>> {
    @Override
    public JsonElement serialize(IntMap<T> intMap, Type typeOfSrc, JsonSerializationContext context) {
        JsonArray jsonArray = new JsonArray();
        for (IntMap.Entry<T> entry : intMap.entries()) {

From source file com.kotcrab.vis.editor.serializer.json.ObjectMapJsonSerializer.java

/** @author Kotcrab */
public class ObjectMapJsonSerializer<K, V>
        implements JsonSerializer<ObjectMap<K, V>>, JsonDeserializer<ObjectMap<K, V>> {
    private static final String PROPERTY_CLASS_KEY = "@class-key";
    private static final String PROPERTY_CLASS_VALUE = "@class-value";