public class InstantiationUtils
extends java.lang.Object
| Constructor and Description | 
|---|
InstantiationUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static <T> T | 
instantiate(java.lang.Class<T> type)
Instantiate the given class rethrowing any exceptions as  
InstantiationException. | 
static <T> T | 
instantiate(java.lang.Class<T> type,
           java.lang.Class<?>[] argTypes,
           java.lang.Object... args)
Instantiate the given class rethrowing any exceptions as  
InstantiationException. | 
static <T> T | 
instantiate(java.lang.String type,
           java.lang.Class<T> requiredType)
Instantiate the given class rethrowing any exceptions as  
InstantiationException. | 
static java.lang.Object | 
instantiate(java.lang.String type,
           java.lang.ClassLoader classLoader)
Instantiate the given class rethrowing any exceptions as  
InstantiationException. | 
static <T> java.util.Optional<T> | 
tryInstantiate(java.lang.Class<T> type)
Try to instantiate the given class using the most optimal strategy first trying the  
BeanIntrospector and
 if no bean is present falling back to reflection. | 
static <T> java.util.Optional<T> | 
tryInstantiate(java.lang.Class<T> type,
              java.util.Map propertiesMap,
              ConversionContext context)
Try to instantiate the given class using  
BeanIntrospector. | 
static <T> java.util.Optional<T> | 
tryInstantiate(java.lang.reflect.Constructor<T> type,
              java.lang.Object... args)
Try to instantiate the given class. 
 | 
static java.util.Optional<?> | 
tryInstantiate(java.lang.String name,
              java.lang.ClassLoader classLoader)
Try to instantiate the given class. 
 | 
public static java.util.Optional<?> tryInstantiate(java.lang.String name,
                                                   java.lang.ClassLoader classLoader)
name - The class nameclassLoader - The class loader to useOptional.empty()@NonNull public static <T> java.util.Optional<T> tryInstantiate(@NonNull java.lang.Class<T> type, java.util.Map propertiesMap, ConversionContext context)
BeanIntrospector.T - The generic typetype - The typepropertiesMap - The properties values Map of the instancecontext - The Conversion contextOptional.empty()InstantiationException - When an error occurs@NonNull public static <T> java.util.Optional<T> tryInstantiate(@NonNull java.lang.Class<T> type)
BeanIntrospector and
 if no bean is present falling back to reflection.T - The generic typetype - The typeOptional.empty()@NonNull public static <T> java.util.Optional<T> tryInstantiate(@NonNull java.lang.reflect.Constructor<T> type, java.lang.Object... args)
T - The generic typetype - The typeargs - The arguments to the constructorOptional.empty()public static <T> T instantiate(java.lang.Class<T> type)
InstantiationException.T - The generic typetype - The typeInstantiationException - When an error occurspublic static <T> T instantiate(java.lang.Class<T> type,
                                java.lang.Class<?>[] argTypes,
                                java.lang.Object... args)
InstantiationException.T - The generic typetype - The typeargTypes - The argument typesargs - The values of argumentsInstantiationException - When an error occurspublic static java.lang.Object instantiate(java.lang.String type,
                                           java.lang.ClassLoader classLoader)
InstantiationException.type - The typeclassLoader - The classloaderInstantiationException - When an error occurspublic static <T> T instantiate(java.lang.String type,
                                java.lang.Class<T> requiredType)
InstantiationException.T - The typetype - The typerequiredType - The required typeInstantiationException - When an error occurs