Interface BeanConstructor<T>

Type Parameters:
T - The bean type
All Superinterfaces:
AnnotationMetadataProvider, AnnotationSource, Described
All Known Implementing Classes:
AbstractBeanConstructor, AbstractBeanDefinitionBeanConstructor, ReflectionBeanConstructor

public interface BeanConstructor<T> extends AnnotationMetadataProvider, Described
Models a bean constructor.
Since:
3.0.0
Author:
graemerocher
  • Method Details

    • getDeclaringBeanType

      Class<T> getDeclaringBeanType()
      Returns the bean type.
      Returns:
      The underlying bean type
    • getArguments

      Argument<?>[] getArguments()
      Returns:
      The constructor argument types.
    • instantiate

      T instantiate(@Nullable Object... parameterValues)
      Instantiate an instance.
      Parameters:
      parameterValues - The parameter values
      Returns:
      The instance, never null.
    • getTargetConstructor

      default @Nullable Constructor<T> getTargetConstructor()
      Returns the Constructor this bean constructor stands for: the constructor of getDeclaringBeanType() whose parameter types are the raw types of 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 null when 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.

      Returns:
      The constructor, or null if the declaring bean type declares no such constructor
      Since:
      5.2.2
    • getDescription

      default String getDescription()
      The description of the constructor.
      Specified by:
      getDescription in interface Described
      Returns:
      The description
    • getDescription

      default String getDescription(boolean simple)
      The description of the constructor.
      Specified by:
      getDescription in interface Described
      Parameters:
      simple - Whether to return a simple representation without package names
      Returns:
      The description