Class ConstructorConstructor

java.lang.Object
com.google.gson.internal.ConstructorConstructor

public final class ConstructorConstructor extends Object
Returns a function that can construct an instance of a requested type.
  • Field Details

  • Constructor Details

  • Method Details

    • checkInstantiable

      static String checkInstantiable(Class<?> c)
      Check if the class can be instantiated by Unsafe allocator. If the instance has interface or abstract modifiers return an exception message.
      Parameters:
      c - instance of the class to be checked
      Returns:
      if instantiable null, else a non-null exception message
    • get

      public <T> ObjectConstructor<T> get(TypeToken<T> typeToken)
    • newSpecialCollectionConstructor

      private static <T> ObjectConstructor<T> newSpecialCollectionConstructor(Type type, Class<? super T> rawType)
      Creates constructors for special JDK collection types which do not have a public no-args constructor.
    • newDefaultConstructor

      private static <T> ObjectConstructor<T> newDefaultConstructor(Class<? super T> rawType, ReflectionAccessFilter.FilterResult filterResult)
    • newDefaultImplementationConstructor

      private static <T> ObjectConstructor<T> newDefaultImplementationConstructor(Type type, Class<? super T> rawType)
      Constructors for common interface types like Map and List and their subtypes.
    • newUnsafeAllocator

      private <T> ObjectConstructor<T> newUnsafeAllocator(Class<? super T> rawType)
    • toString

      public String toString()
      Overrides:
      toString in class Object