Class ReflectionBeanConstructor<T>
java.lang.Object
io.micronaut.reflection.ReflectionBeanConstructor<T>
- Type Parameters:
T- The bean type
- All Implemented Interfaces:
AnnotationMetadataProvider, AnnotationSource, BeanConstructor<T>, Described
A
BeanConstructor over a Constructor, with the arguments and the annotation metadata a
generated constructor would have. A non-static inner class is instantiated as
Constructor.newInstance(Object...) instantiates it: the enclosing instance is the first argument.- Since:
- 5.2.0
- Author:
- Denis Stepanov
-
Field Summary
Fields inherited from interface AnnotationSource
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionReflectionBeanConstructor(Constructor<T> constructor) Creates a bean constructor over a constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanSupplies the metadata.Argument<?>[]The constructor this bean constructor instantiates through.Returns the bean type.Returns theConstructorthis bean constructor stands for: the constructor ofBeanConstructor.getDeclaringBeanType()whose parameter types are the raw types ofBeanConstructor.getArguments().inthashCode()instantiate(@Nullable Object... parameterValues) Instantiate an instance.static <T> ReflectionBeanConstructor<T> of(Constructor<T> constructor) The bean constructor of a constructor.toString()Methods inherited from interface AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface BeanConstructor
getDescription, getDescription
-
Constructor Details
-
ReflectionBeanConstructor
Creates a bean constructor over a constructor.- Parameters:
constructor- The constructor
-
-
Method Details
-
of
The bean constructor of a constructor.- Type Parameters:
T- The bean type- Parameters:
constructor- The constructor- Returns:
- The bean constructor
-
getConstructor
The constructor this bean constructor instantiates through.- Returns:
- The constructor
-
getDeclaringBeanType
Description copied from interface:BeanConstructorReturns the bean type.- Specified by:
getDeclaringBeanTypein interfaceBeanConstructor<T>- Returns:
- The underlying bean type
-
getArguments
- Specified by:
getArgumentsin interfaceBeanConstructor<T>- Returns:
- The constructor argument types.
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Returns:
- The
AnnotationMetadata
-
getTargetConstructor
Description copied from interface:BeanConstructorReturns theConstructorthis bean constructor stands for: the constructor ofBeanConstructor.getDeclaringBeanType()whose parameter types are the raw types ofBeanConstructor.getArguments().This is the counterpart of
io.micronaut.inject.MethodReference#getTargetMethod()for constructors. Framework implementations resolve the constructor once and hold it; this default resolves it on every call, so an implementation that knows its constructor should return it directly.The result is
nullwhen the bean is not created through a constructor of the declaring bean type: a bean produced by a factory method or field, or an introspection instantiating through a static creator method, even one whose parameter types a declared constructor shares.- Specified by:
getTargetConstructorin interfaceBeanConstructor<T>- Returns:
- The constructor, or
nullif the declaring bean type declares no such constructor
-
instantiate
Description copied from interface:BeanConstructorInstantiate an instance.- Specified by:
instantiatein interfaceBeanConstructor<T>- Parameters:
parameterValues- The parameter values- Returns:
- The instance, never null.
-
equals
-
hashCode
-
toString
-