Examples of registerTypeHierarchyAdapter()


Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

      builder.registerTypeAdapterFactory(new DeserializationConstructorAndReflectiveTypeAdapterFactory(
            new ConstructorConstructor(), serializationPolicy, Excluder.DEFAULT, deserializationPolicy));

      // complicated (serializers/deserializers as they need context to operate)
      builder.registerTypeHierarchyAdapter(Enum.class, new EnumTypeAdapterThatReturnsFromValue());

      for (Map.Entry<Type, Object> binding : bindings.getBindings().entrySet()) {
         builder.registerTypeAdapter(binding.getKey(), binding.getValue());
      }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

      builder.registerTypeAdapterFactory(new DeserializationConstructorAndReflectiveTypeAdapterFactory(
            new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of()), serializationPolicy, Excluder.DEFAULT, deserializationPolicy));

      // complicated (serializers/deserializers as they need context to operate)
      builder.registerTypeHierarchyAdapter(Enum.class, new EnumTypeAdapterThatReturnsFromValue());

      for (Map.Entry<Type, Object> binding : bindings.getBindings().entrySet()) {
         builder.registerTypeAdapter(binding.getKey(), binding.getValue());
      }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

  protected Gson getGson() {
    GsonBuilder builder = new GsonBuilder();

    for (JsonDeserializer<?> adapter : adapters) {
      builder.registerTypeHierarchyAdapter(getAdapterType(adapter), adapter);
    }

    return builder.create();
  }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

  protected Gson getGson() {
    GsonBuilder builder = new GsonBuilder();

    for (JsonDeserializer<?> adapter : adapters) {
      builder.registerTypeHierarchyAdapter(getAdapterType(adapter), adapter);
    }

    return builder.create();
  }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

  protected Gson getGson() {
    GsonBuilder builder = new GsonBuilder();

    for (JsonDeserializer<?> adapter : adapters) {
      builder.registerTypeHierarchyAdapter(getAdapterType(adapter), adapter);
    }

    return builder.create();
  }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

      builder.registerTypeAdapterFactory(new DeserializationConstructorAndReflectiveTypeAdapterFactory(
            new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of()), serializationPolicy, Excluder.DEFAULT, deserializationPolicy));

      // complicated (serializers/deserializers as they need context to operate)
      builder.registerTypeHierarchyAdapter(Enum.class, new EnumTypeAdapterThatReturnsFromValue());

      for (Map.Entry<Type, Object> binding : bindings.getBindings().entrySet()) {
         builder.registerTypeAdapter(binding.getKey(), binding.getValue());
      }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

  protected Gson getGson() {
    GsonBuilder builder = new GsonBuilder();

    for (JsonDeserializer<?> adapter : adapters) {
      builder.registerTypeHierarchyAdapter(getAdapterType(adapter), adapter);
    }

    return builder.create();
  }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

      builder.registerTypeAdapterFactory(new DeserializationConstructorAndReflectiveTypeAdapterFactory(
            new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of()), serializationPolicy, Excluder.DEFAULT, deserializationPolicy));

      // complicated (serializers/deserializers as they need context to operate)
      builder.registerTypeHierarchyAdapter(Enum.class, new EnumTypeAdapterThatReturnsFromValue());

      for (Map.Entry<Type, Object> binding : bindings.getBindings().entrySet()) {
         builder.registerTypeAdapter(binding.getKey(), binding.getValue());
      }
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

    // Assert that Base64 support is available, as long we're not on Java 8+
    Base64Utils.encode(null);

    // Now, construct a pre-configured GsonBuilder...
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeHierarchyAdapter(byte[].class, new Base64TypeAdapter());
    return builder;
  }


  private static class Base64TypeAdapter implements JsonSerializer<byte[]>, JsonDeserializer<byte[]> {
View Full Code Here

Examples of com.google.gson.GsonBuilder.registerTypeHierarchyAdapter()

  protected Gson getGson() {
    GsonBuilder builder = new GsonBuilder();

    for (JsonDeserializer<?> adapter : adapters) {
      builder.registerTypeHierarchyAdapter(getAdapterType(adapter), adapter);
    }

    return builder.create();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.