Class TargetConstructorCache<T>
java.lang.Object
io.micronaut.core.beans.TargetConstructorCache<T>
- Type Parameters:
T- The bean type
Holds the
Constructor a BeanConstructor resolved, so that it is resolved once, whether or not
there is one. A null result is held the same way as a found constructor: the bean type may not declare
a constructor with the arguments, or the bean may not be created through a constructor at all.- Since:
- 5.2.2
- Author:
- Denis Stepanov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Constructor<T> get(Supplier<@Nullable Constructor<T>> resolver) Returns the held constructor, resolving it on the first call.static <T> @Nullable Constructor<T> resolve(BeanConstructor<T> beanConstructor) Resolves the declared constructor of the bean type whose parameter types are the raw types of the bean constructor's arguments, the resolutionBeanConstructor.getTargetConstructor()performs by default.
-
Constructor Details
-
TargetConstructorCache
public TargetConstructorCache()
-
-
Method Details
-
get
Returns the held constructor, resolving it on the first call. Concurrent first calls may each resolve, and hold equal constructors.- Parameters:
resolver- The resolution- Returns:
- The constructor, or
nullif the resolution produced none
-
resolve
Resolves the declared constructor of the bean type whose parameter types are the raw types of the bean constructor's arguments, the resolutionBeanConstructor.getTargetConstructor()performs by default.- Type Parameters:
T- The bean type- Parameters:
beanConstructor- The bean constructor- Returns:
- The constructor, or
nullif the bean type declares no such constructor
-