Class ConstructorConstructor


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

      • instanceCreators

        private final java.util.Map<java.lang.reflect.Type,​InstanceCreator<?>> instanceCreators
      • useJdkUnsafe

        private final boolean useJdkUnsafe
    • Constructor Detail

      • ConstructorConstructor

        public ConstructorConstructor​(java.util.Map<java.lang.reflect.Type,​InstanceCreator<?>> instanceCreators,
                                      boolean useJdkUnsafe,
                                      java.util.List<ReflectionAccessFilter> reflectionFilters)
    • Method Detail

      • checkInstantiable

        static java.lang.String checkInstantiable​(java.lang.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
      • newSpecialCollectionConstructor

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

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

        private <T> ObjectConstructor<T> newUnsafeAllocator​(java.lang.Class<? super T> rawType)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object