Class DefaultImplementationTypeAdapterFactory<S,T extends S>

java.lang.Object
org.mule.runtime.extension.internal.persistence.DefaultImplementationTypeAdapterFactory<S,T>
All Implemented Interfaces:
com.google.gson.TypeAdapterFactory

public final class DefaultImplementationTypeAdapterFactory<S,T extends S> extends Object implements com.google.gson.TypeAdapterFactory
TypeAdapterFactory implementation, which creates TypeAdapters that for any subclass of DefaultImplementationTypeAdapterFactory, fixes the serialization and deserialization to unique class DefaultImplementationTypeAdapterFactory.

Does not matter which subclass of DefaultImplementationTypeAdapterFactory is found, this factory will create TypeAdapters of DefaultImplementationTypeAdapterFactory type.

Since:
1.0
  • Constructor Details

    • DefaultImplementationTypeAdapterFactory

      public DefaultImplementationTypeAdapterFactory(Class<S> superClass, Class<T> clazz)
      Parameters:
      superClass - class that will be used to look for implementations of it, at serialization and deserialization time
      clazz - class to fix the serialization or deserialization
  • Method Details

    • create

      public <C> com.google.gson.TypeAdapter<C> create(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<C> type)
      Specified by:
      create in interface com.google.gson.TypeAdapterFactory
      Type Parameters:
      C - type of objects that the TypeAdapter will create
      Parameters:
      gson - The actual Gson serializer
      type - Implementation that Gson is trying to find a TypeAdapter
      Returns:
      if is subclass of superClass a TypeAdapter, that serializes and deserialize DefaultImplementationTypeAdapterFactory instances