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 com.atlauncher.workers.EnumTypeAdapterFactory.java

public class EnumTypeAdapterFactory implements TypeAdapterFactory {

    @Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        if (!type.getRawType().isEnum())
            return null;

From source file com.chalup.gsonadapters.JsonRootAdapterFactory.java

public class JsonRootAdapterFactory implements TypeAdapterFactory {

    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.TYPE)
    public @interface JsonRootName {
        String value();

From source file com.citymaps.mobile.android.util.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 com.codefororlando.streettrees.api.deserializer.ResponseSanitizer.java

public class ResponseSanitizer implements TypeAdapterFactory {
    @Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
        return new TypeAdapter<T>() {
            public void write(JsonWriter out, T value) throws IOException {

From source file com.continuuity.loom.codec.json.LowercaseEnumTypeAdapterFactory.java

/**
 * Adapter for lowercasing enums.
 */
public class LowercaseEnumTypeAdapterFactory implements TypeAdapterFactory {
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        Class<T> rawType = (Class<T>) type.getRawType();

From source file com.cyanogenmod.account.gcm.model.MessageTypeAdapterFactory.java

public class MessageTypeAdapterFactory implements TypeAdapterFactory {

    private static MessageTypeAdapterFactory mInstance;

    public static MessageTypeAdapterFactory getInstance() {
        if (mInstance == null) {

From source file com.dampcake.gson.immutable.ImmutableAdapterFactory.java

/**
 * {@link TypeAdapterFactory} for de-serializing Gson Immutable types.
 * 
 * @author Adam Peck
 */
public final class ImmutableAdapterFactory implements TypeAdapterFactory {

From source file com.datastore_android_sdk.serialization.ForeignCollectionTypeAdapterFactory.java

/**
 * Type adapter that reflects over the fields and methods of a 'ForeignCollection' class.
 * 
 * @author Stanley Lam
 */
public class ForeignCollectionTypeAdapterFactory implements TypeAdapterFactory {

From source file com.datastore_android_sdk.serialization.ModelTypeAdapterFactory.java

/**
 * Type adapter that reflects over the fields and methods of a 'Model' class.
 */
public class ModelTypeAdapterFactory implements TypeAdapterFactory {

    protected final ConstructorConstructor constructorConstructor;

From source file com.defano.wyldcard.runtime.serializer.PostConstructAdapterFactory.java

/**
 * The class instructs Gson to invoke @PostConstruct-annotated methods on classes that are deserialized. Useful when
 * deserializing objects the require initialization after deserialization.
 *
 * From: https://gist.github.com/swankjesse/20df26adaf639ed7fd160f145a0b661a
 */