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

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

Introduction

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

Usage

From source file net.sf.anathema.platform.persistence.RuntimeTypeAdapterFactory.java

/**
 * Adapts values whose runtime type may differ from their declaration type. This
 * is necessary when a field's type is not the same type that GSON should create
 * when deserializing that field. For example, consider these types:
 * <pre>   {@code
 *   abstract class Shape {

From source file net.technicpack.launchercore.util.LowerCaseEnumTypeAdapterFactory.java

public class LowerCaseEnumTypeAdapterFactory implements TypeAdapterFactory {

    @SuppressWarnings("unchecked")
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        Class rawType = type.getRawType();
        if (!rawType.isEnum()) {

From source file net.technicpack.utilslib.LowerCaseEnumTypeAdapterFactory.java

public class LowerCaseEnumTypeAdapterFactory implements TypeAdapterFactory {

    @SuppressWarnings("unchecked")
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        Class rawType = type.getRawType();
        if (!rawType.isEnum()) {

From source file network.thunder.core.communication.layer.low.serialisation.RuntimeTypeAdapterFactory.java

/**
 * Adapts values whose runtime type may differ from their declaration type. This
 * is necessary when a field's type is not the same type that GSON should create
 * when deserializing that field. For example, consider these types:
 * <pre>   {@code
 *   abstract class Shape {

From source file network.thunder.core.communication.RuntimeTypeAdapterFactory.java

/**
 * Adapts values whose runtime type may differ from their declaration type. This
 * is necessary when a field's type is not the same type that GSON should create
 * when deserializing that field. For example, consider these types:
 * <pre>   {@code
 *   abstract class Shape {

From source file networkUtils.RuntimeTypeAdapterFactory.java

/**
 * Adapts values whose runtime type may differ from their declaration type. This
 * is necessary when a field's type is not the same type that GSON should create
 * when deserializing that field. For example, consider these types:
 * <pre>   {@code
 *   abstract class Shape {

From source file nz.bradcampbell.benchmarkdemo.model.autovalueparcel.GsonAdapterFactory.java

@GsonTypeAdapterFactory
public abstract class GsonAdapterFactory implements TypeAdapterFactory {
    public static TypeAdapterFactory create() {
        return new AutoValueGson_GsonAdapterFactory();
    }
}

From source file org.apache.gobblin.util.io.GsonInterfaceAdapter.java

/**
 * A {@link Gson} interface adapter that makes it possible to serialize and deserialize polymorphic objects.
 *
 * <p>
 *   This adapter will capture all instances of {@link #baseClass} and write them as
 *   {"object-type":"class.name", "object-data":"data"}, allowing for correct serialization and deserialization of

From source file org.apache.predictionio.workflow.JavaQueryTypeAdapterFactory.java

public class JavaQueryTypeAdapterFactory implements TypeAdapterFactory {
    @Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        if (type.getRawType().equals(JavaQuery.class)) {
            return (TypeAdapter<T>) new TypeAdapter<JavaQuery>() {
                public void write(JsonWriter out, JavaQuery value) throws IOException {

From source file org.apache.zeppelin.display.RuntimeTypeAdapterFactory.java

/**
 * Copied from gson with minor changes to support old input forms
 *
 * @param <T>
 */
public class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {