Class HierarchicalArrayGson<T>

java.lang.Object
org.oddjob.web.gson.plugin.HierarchicalArrayGson<T>
All Implemented Interfaces:
com.google.gson.JsonDeserializer<T[]>, com.google.gson.JsonSerializer<T[]>, GsonConfigurator

public class HierarchicalArrayGson<T> extends Object implements com.google.gson.JsonSerializer<T[]>, com.google.gson.JsonDeserializer<T[]>, GsonConfigurator
Json Adapter for a Hierarchical Array Bean Type.
  • Field Details

  • Method Details

    • forHierarchicalArray

      public static <T> GsonConfigurator forHierarchicalArray(Class<T[]> arrayType, ClassResolver classResolver)
    • configure

      public com.google.gson.GsonBuilder configure(com.google.gson.GsonBuilder gsonBuilder)
      Description copied from interface: GsonConfigurator
      Configure a GsonBuilder by adding Type Adapters etc. to it.
      Specified by:
      configure in interface GsonConfigurator
      Parameters:
      gsonBuilder - The Builder
      Returns:
      The same Builder for fluidity.
    • serialize

      public com.google.gson.JsonElement serialize(T[] src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<T>
    • deserialize

      public T[] deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<T>
      Throws:
      com.google.gson.JsonParseException