类 Instantiator<T>
java.lang.Object
org.springframework.boot.util.Instantiator<T>
- 类型参数:
T
- the type to instantiate
Simple factory used to instantiate objects by injecting available parameters.
- 从以下版本开始:
- 2.4.0
- 作者:
- Phillip Webb, Scott Frederick
-
嵌套类概要
嵌套类修饰符和类型类说明static interface
Callback used to register available parameters.static interface
Strategy for handling a failure that occurs when instantiating a type. -
构造器概要
构造器构造器说明Instantiator
(Class<?> type, Consumer<Instantiator.AvailableParameters> availableParameters) Create a newInstantiator
instance for the given type.Instantiator
(Class<?> type, Consumer<Instantiator.AvailableParameters> availableParameters, Instantiator.FailureHandler failureHandler) Create a newInstantiator
instance for the given type. -
方法概要
修饰符和类型方法说明<A> A
Get an injectable argument instance for the given type.instantiate
(ClassLoader classLoader, String name) Instantiate the given set of class name, injecting constructor arguments as necessary.instantiate
(ClassLoader classLoader, Collection<String> names) Instantiate the given set of class name, injecting constructor arguments as necessary.instantiate
(String name) Instantiate the given set of class name, injecting constructor arguments as necessary.instantiate
(Collection<String> names) Instantiate the given set of class name, injecting constructor arguments as necessary.instantiateType
(Class<?> type) Instantiate the given class, injecting constructor arguments as necessary.instantiateTypes
(Collection<Class<?>> types) Instantiate the given set of classes, injecting constructor arguments as necessary.
-
构造器详细资料
-
Instantiator
Create a newInstantiator
instance for the given type.- 参数:
type
- the type to instantiateavailableParameters
- consumer used to register available parameters
-
Instantiator
public Instantiator(Class<?> type, Consumer<Instantiator.AvailableParameters> availableParameters, Instantiator.FailureHandler failureHandler) Create a newInstantiator
instance for the given type.- 参数:
type
- the type to instantiateavailableParameters
- consumer used to register available parametersfailureHandler
- aInstantiator.FailureHandler
that will be called in case of failure when instantiating objects- 从以下版本开始:
- 2.7.0
-
-
方法详细资料
-
instantiate
Instantiate the given set of class name, injecting constructor arguments as necessary.- 参数:
names
- the class names to instantiate- 返回:
- a list of instantiated instances
-
instantiate
Instantiate the given set of class name, injecting constructor arguments as necessary.- 参数:
classLoader
- the source classloadernames
- the class names to instantiate- 返回:
- a list of instantiated instances
- 从以下版本开始:
- 2.4.8
-
instantiate
Instantiate the given set of class name, injecting constructor arguments as necessary.- 参数:
name
- the class name to instantiate- 返回:
- an instantiated instance
- 从以下版本开始:
- 3.4.0
-
instantiate
Instantiate the given set of class name, injecting constructor arguments as necessary.- 参数:
classLoader
- the source classloadername
- the class name to instantiate- 返回:
- an instantiated instance
- 从以下版本开始:
- 3.4.0
-
instantiateType
Instantiate the given class, injecting constructor arguments as necessary.- 参数:
type
- the type to instantiate- 返回:
- an instantiated instance
- 从以下版本开始:
- 3.4.0
-
instantiateTypes
Instantiate the given set of classes, injecting constructor arguments as necessary.- 参数:
types
- the types to instantiate- 返回:
- a list of instantiated instances
- 从以下版本开始:
- 2.4.8
-
getArg
Get an injectable argument instance for the given type. This method can be used when manually instantiating an object without reflection.- 类型参数:
A
- the argument type- 参数:
type
- the argument type- 返回:
- the argument to inject or
null
- 从以下版本开始:
- 3.4.0
-