Class AbstractBeanDefinition<T>

  • Type Parameters:
    T - The Bean definition type
    All Implemented Interfaces:
    EnvironmentConfigurable, io.micronaut.core.annotation.AnnotationMetadata, io.micronaut.core.annotation.AnnotationMetadataDelegate, io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, io.micronaut.core.naming.Named, io.micronaut.core.type.ArgumentCoercible<T>, BeanContextConditional, BeanDefinition<T>, BeanType<T>
    Direct Known Subclasses:
    AbstractParametrizedBeanDefinition

    @Internal
    public class AbstractBeanDefinition<T>
    extends java.lang.Object
    implements BeanDefinition<T>, EnvironmentConfigurable

    Default implementation of the BeanDefinition interface. This class is generally not used directly in user code. Instead a build time tool does analysis of source code and dynamically produces subclasses of this class containing information about the available injection points for a given class.

    For technical reasons the class has to be marked as public, but is regarded as internal and should be used by compiler tools and plugins (such as AST transformation frameworks)

    The BeanDefinitionWriter class can be used to produce bean definitions at compile or runtime

    Since:
    1.0
    See Also:
    BeanDefinitionWriter
    • Field Detail

      • methodInjectionPoints

        protected final java.util.List<MethodInjectionPoint<T,​?>> methodInjectionPoints
      • fieldInjectionPoints

        protected final java.util.List<FieldInjectionPoint<T,​?>> fieldInjectionPoints
      • executableMethodMap

        protected java.util.Map<io.micronaut.context.AbstractBeanDefinition.MethodKey,​ExecutableMethod<T,​?>> executableMethodMap
    • Constructor Detail

      • AbstractBeanDefinition

        @Internal
        protected AbstractBeanDefinition​(java.lang.Class<T> producedType,
                                         java.lang.Class<?> declaringType,
                                         java.lang.String fieldName,
                                         io.micronaut.core.annotation.AnnotationMetadata fieldMetadata,
                                         boolean isFinal)
        Constructs a bean definition that is produced from a method call on another type (factory bean).
        Parameters:
        producedType - The produced type
        declaringType - The declaring type of the method
        fieldName - The method name
        fieldMetadata - The metadata for the method
        isFinal - Is the field final
        Since:
        3.0
      • AbstractBeanDefinition

        @Internal
        protected AbstractBeanDefinition​(java.lang.Class<T> producedType,
                                         java.lang.Class<?> declaringType,
                                         java.lang.String methodName,
                                         io.micronaut.core.annotation.AnnotationMetadata methodMetadata,
                                         boolean requiresReflection,
                                         io.micronaut.core.type.Argument<?>... arguments)
        Constructs a bean definition that is produced from a method call on another type (factory bean).
        Parameters:
        producedType - The produced type
        declaringType - The declaring type of the method
        methodName - The method name
        methodMetadata - The metadata for the method
        requiresReflection - Whether reflection is required to invoke the method
        arguments - The method arguments
      • AbstractBeanDefinition

        @Internal
        protected AbstractBeanDefinition​(java.lang.Class<T> type,
                                         io.micronaut.core.annotation.AnnotationMetadata constructorAnnotationMetadata,
                                         boolean requiresReflection,
                                         io.micronaut.core.type.Argument... arguments)
        Constructs a bean for the given type.
        Parameters:
        type - The type
        constructorAnnotationMetadata - The annotation metadata for the constructor
        requiresReflection - Whether reflection is required
        arguments - The constructor arguments used to build the bean
    • Method Detail

      • hasPropertyExpressions

        public final boolean hasPropertyExpressions()
        Specified by:
        hasPropertyExpressions in interface io.micronaut.core.annotation.AnnotationMetadata
        Specified by:
        hasPropertyExpressions in interface io.micronaut.core.annotation.AnnotationMetadataDelegate
        Specified by:
        hasPropertyExpressions in interface EnvironmentConfigurable
        Returns:
        Whether any environment specific property expressions exist in the object.
      • getTypeArguments

        @NonNull
        public java.util.List<io.micronaut.core.type.Argument<?>> getTypeArguments​(java.lang.String type)
        Description copied from interface: BeanDefinition
        Return the type arguments for the given interface or super type for this bean.
        Specified by:
        getTypeArguments in interface BeanDefinition<T>
        Parameters:
        type - The super class or interface type
        Returns:
        The type arguments
      • getAnnotationMetadata

        @NonNull
        public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
        Specified by:
        getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
      • isAbstract

        public boolean isAbstract()
        Specified by:
        isAbstract in interface BeanDefinition<T>
        Returns:
        Whether the bean definition is abstract
      • isPrimary

        public boolean isPrimary()
        Specified by:
        isPrimary in interface BeanType<T>
        Returns:
        Whether the bean definition is the Primary
      • findMethod

        public <R> java.util.Optional<ExecutableMethod<T,​R>> findMethod​(java.lang.String name,
                                                                              java.lang.Class<?>... argumentTypes)
        Description copied from interface: BeanDefinition
        Finds a single ExecutableMethod for the given name and argument types.
        Specified by:
        findMethod in interface BeanDefinition<T>
        Type Parameters:
        R - The return type
        Parameters:
        name - The method name
        argumentTypes - The argument types
        Returns:
        An optional ExecutableMethod
      • findPossibleMethods

        public java.util.stream.Stream<ExecutableMethod<T,​?>> findPossibleMethods​(java.lang.String name)
        Description copied from interface: BeanDefinition
        Finds possible methods for the given method name.
        Specified by:
        findPossibleMethods in interface BeanDefinition<T>
        Parameters:
        name - The method name
        Returns:
        The possible methods
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isProvided

        public boolean isProvided()
        Specified by:
        isProvided in interface BeanDefinition<T>
        Returns:
        Is this definition provided by another bean
        See Also:
        Provided
      • getScope

        public java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getScope()
        Specified by:
        getScope in interface BeanDefinition<T>
        Returns:
        The scope of the bean
      • getScopeName

        public java.util.Optional<java.lang.String> getScopeName()
        Specified by:
        getScopeName in interface BeanDefinition<T>
        Returns:
        The name of the scope
      • getExposedTypes

        @NonNull
        public final java.util.Set<java.lang.Class<?>> getExposedTypes()
        Description copied from interface: BeanType
        Returns a potentially limited subset of bean types exposed by this bean. The types to be exposed can be defined by the Type annotation.
        Specified by:
        getExposedTypes in interface BeanType<T>
        Returns:
        The exposed types
      • getDeclaringType

        public final java.util.Optional<java.lang.Class<?>> getDeclaringType()
        Specified by:
        getDeclaringType in interface BeanDefinition<T>
        Returns:
        The type that declares this definition, null if not applicable.
      • getRequiredComponents

        public java.util.Collection<java.lang.Class<?>> getRequiredComponents()
        Specified by:
        getRequiredComponents in interface BeanDefinition<T>
        Returns:
        All required components for this entity definition
      • getInjectedMethods

        public final java.util.Collection<MethodInjectionPoint<T,​?>> getInjectedMethods()
        Description copied from interface: BeanDefinition
        All methods that require injection. This is a subset of all the methods in the class.
        Specified by:
        getInjectedMethods in interface BeanDefinition<T>
        Returns:
        The required properties
      • getPostConstructMethods

        public final java.util.Collection<MethodInjectionPoint<T,​?>> getPostConstructMethods()
        Description copied from interface: BeanDefinition
        All the methods that should be called once the bean has been fully initialized and constructed.
        Specified by:
        getPostConstructMethods in interface BeanDefinition<T>
        Returns:
        Methods to call post construct
      • getName

        @NonNull
        public java.lang.String getName()
        Specified by:
        getName in interface BeanDefinition<T>
        Specified by:
        getName in interface BeanType<T>
        Specified by:
        getName in interface io.micronaut.core.naming.Named
        Returns:
        The class name
      • inject

        public T inject​(BeanContext context,
                        T bean)
        Description copied from interface: BeanDefinition
        Inject the given bean with the context.
        Specified by:
        inject in interface BeanDefinition<T>
        Parameters:
        context - The context
        bean - The bean
        Returns:
        The injected bean
      • inject

        public T inject​(BeanResolutionContext resolutionContext,
                        BeanContext context,
                        T bean)
        Description copied from interface: BeanDefinition
        Inject the given bean with the context.
        Specified by:
        inject in interface BeanDefinition<T>
        Parameters:
        resolutionContext - the resolution context
        context - The context
        bean - The bean
        Returns:
        The injected bean
      • configure

        @Internal
        public final void configure​(Environment environment)
        Configures the bean for the given BeanContext. If the context features an Environment this method configures the annotation metadata such that environment aware values are returned.
        Specified by:
        configure in interface EnvironmentConfigurable
        Parameters:
        environment - The environment
      • warn

        @Internal
        protected final void warn​(java.lang.String message)
        Allows printing warning messages produced by the compiler.
        Parameters:
        message - The message
      • warnMissingProperty

        @Internal
        protected final void warnMissingProperty​(java.lang.Class type,
                                                 java.lang.String method,
                                                 java.lang.String property)
        Allows printing warning messages produced by the compiler.
        Parameters:
        type - The type
        method - The method
        property - The property
      • getProxiedBean

        @Internal
        protected final java.lang.Object getProxiedBean​(BeanContext beanContext)
        Resolves the proxied bean instance for this bean.
        Parameters:
        beanContext - The BeanContext
        Returns:
        The proxied bean
      • addInjectionPoint

        @Internal
        protected final AbstractBeanDefinition addInjectionPoint​(java.lang.Class declaringType,
                                                                 java.lang.Class fieldType,
                                                                 java.lang.String field,
                                                                 @Nullable
                                                                 io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
                                                                 @Nullable
                                                                 io.micronaut.core.type.Argument[] typeArguments,
                                                                 boolean requiresReflection)
        Adds an injection point for a field. Typically called by a dynamically generated subclass.
        Parameters:
        declaringType - The declaring type
        fieldType - The field type
        field - The name of the field
        annotationMetadata - The annotation metadata for the field
        typeArguments - The arguments
        requiresReflection - Whether reflection is required
        Returns:
        this component definition
      • addInjectionPoint

        @Internal
        protected final AbstractBeanDefinition addInjectionPoint​(java.lang.Class declaringType,
                                                                 java.lang.String method,
                                                                 @Nullable
                                                                 io.micronaut.core.type.Argument[] arguments,
                                                                 @Nullable
                                                                 io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
                                                                 boolean requiresReflection)
        Adds an injection point for a method that cannot be resolved at runtime, but a compile time produced injection point exists. This allows the framework to recover and relay better error messages to the user instead of just NoSuchMethodError.
        Parameters:
        declaringType - The declaring type
        method - The method
        arguments - The argument types
        annotationMetadata - The annotation metadata
        requiresReflection - Whether the method requires reflection to invoke
        Returns:
        this component definition
      • addPostConstruct

        @Internal
        protected final AbstractBeanDefinition addPostConstruct​(java.lang.Class declaringType,
                                                                java.lang.String method,
                                                                @Nullable
                                                                io.micronaut.core.type.Argument[] arguments,
                                                                @Nullable
                                                                io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
                                                                boolean requiresReflection)
        Adds a post construct method definition.
        Parameters:
        declaringType - The declaring type
        method - The method
        arguments - The arguments
        annotationMetadata - The annotation metadata
        requiresReflection - Whether the method requires reflection
        Returns:
        This bean definition
      • addPreDestroy

        @Internal
        protected final AbstractBeanDefinition addPreDestroy​(java.lang.Class declaringType,
                                                             java.lang.String method,
                                                             io.micronaut.core.type.Argument[] arguments,
                                                             io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
                                                             boolean requiresReflection)
        Adds a pre destroy method definition.
        Parameters:
        declaringType - The declaring type
        method - The method
        arguments - The arguments
        annotationMetadata - The annotation metadata
        requiresReflection - Whether the method requires reflection
        Returns:
        This bean definition
      • injectBean

        @Internal
        protected java.lang.Object injectBean​(BeanResolutionContext resolutionContext,
                                              BeanContext context,
                                              java.lang.Object bean)
        The default implementation which provides no injection. To be overridden by compile time tooling.
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        bean - The bean
        Returns:
        The injected bean
      • injectAnother

        @Internal
        protected java.lang.Object injectAnother​(BeanResolutionContext resolutionContext,
                                                 BeanContext context,
                                                 java.lang.Object bean)
        Inject another bean, for example one created via factory.
        Parameters:
        resolutionContext - The reslution context
        context - The context
        bean - The bean
        Returns:
        The bean
      • postConstruct

        @Internal
        protected java.lang.Object postConstruct​(BeanResolutionContext resolutionContext,
                                                 BeanContext context,
                                                 java.lang.Object bean)
        Default postConstruct hook that only invokes methods that require reflection. Generated subclasses should override to call methods that don't require reflection.
        Parameters:
        resolutionContext - The resolution hook
        context - The context
        bean - The bean
        Returns:
        The bean
      • preDestroy

        protected java.lang.Object preDestroy​(BeanResolutionContext resolutionContext,
                                              BeanContext context,
                                              java.lang.Object bean)
        Default preDestroy hook that only invokes methods that require reflection. Generated subclasses should override to call methods that don't require reflection.
        Parameters:
        resolutionContext - The resolution hook
        context - The context
        bean - The bean
        Returns:
        The bean
      • injectBeanMethod

        @Internal
        protected void injectBeanMethod​(BeanResolutionContext resolutionContext,
                                        DefaultBeanContext context,
                                        int methodIndex,
                                        java.lang.Object bean)
        Inject a bean method that requires reflection.
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        methodIndex - The method index
        bean - The bean
      • injectBeanField

        @Internal
        protected final void injectBeanField​(BeanResolutionContext resolutionContext,
                                             DefaultBeanContext context,
                                             int index,
                                             java.lang.Object bean)
        Injects the value of a field of a bean that requires reflection.
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        index - The index of the field
        bean - The bean being injected
      • getValueForMethodArgument

        @Internal
        protected final java.lang.Object getValueForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                   BeanContext context,
                                                                   int methodIndex,
                                                                   int argIndex)
        Obtains a value for the given method argument.
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        methodIndex - The method index
        argIndex - The argument index
        Returns:
        The value
      • containsValueForMethodArgument

        @Internal
        protected final boolean containsValueForMethodArgument​(BeanResolutionContext resolutionContext,
                                                               BeanContext context,
                                                               int methodIndex,
                                                               int argIndex)
        Obtains a value for the given method argument.
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        methodIndex - The method index
        argIndex - The argument index
        Returns:
        The value
      • getBeanForMethodArgument

        @Internal
        protected final java.lang.Object getBeanForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                  BeanContext context,
                                                                  int methodIndex,
                                                                  int argIndex)
        Obtains a bean definition for the method at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        methodIndex - The method index
        argIndex - The argument index
        Returns:
        The resolved bean
      • getBeansOfTypeForMethodArgument

        @Internal
        protected final java.util.Collection getBeansOfTypeForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                             BeanContext context,
                                                                             MethodInjectionPoint injectionPoint,
                                                                             io.micronaut.core.type.Argument argument)
        Obtains all bean definitions for the method at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        injectionPoint - The method injection point
        argument - The argument
        Returns:
        The resolved bean
      • findBeanForMethodArgument

        @Internal
        protected final java.util.Optional findBeanForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                     BeanContext context,
                                                                     MethodInjectionPoint injectionPoint,
                                                                     io.micronaut.core.type.Argument argument)
        Obtains an optional bean for the method at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        injectionPoint - The method injection point
        argument - The argument
        Returns:
        The resolved bean
      • streamOfTypeForMethodArgument

        @Internal
        protected final java.util.stream.Stream streamOfTypeForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                              BeanContext context,
                                                                              MethodInjectionPoint injectionPoint,
                                                                              io.micronaut.core.type.Argument argument)
        Obtains all bean definitions for the method at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        injectionPoint - The method injection point
        argument - The argument
        Returns:
        The resolved bean
      • getBeanForConstructorArgument

        @Internal
        protected final java.lang.Object getBeanForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                       BeanContext context,
                                                                       int argIndex)
        Obtains a bean definition for a constructor at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        argIndex - The argument index
        Returns:
        The resolved bean
      • getValueForConstructorArgument

        @Internal
        protected final java.lang.Object getValueForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                        BeanContext context,
                                                                        int argIndex)
        Obtains a value for a bean definition for a constructor at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        argIndex - The argument index
        Returns:
        The resolved bean
      • getBeansOfTypeForConstructorArgument

        @Internal
        protected final java.util.Collection getBeansOfTypeForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                                  BeanContext context,
                                                                                  ConstructorInjectionPoint<T> constructorInjectionPoint,
                                                                                  io.micronaut.core.type.Argument argument)
        Obtains all bean definitions for a constructor argument at the given index.
        Parameters:
        resolutionContext - The resolution context
        context - The context
        constructorInjectionPoint - The constructor injection point
        argument - The argument
        Returns:
        The resolved bean
      • getBeansOfTypeForConstructorArgument

        @Internal
        protected final java.lang.Object getBeansOfTypeForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                              BeanContext context,
                                                                              int argumentIndex)
        Obtains all bean definitions for a constructor argument at the given index.
        Parameters:
        resolutionContext - The resolution context
        context - The context
        argumentIndex - The argument index
        Returns:
        The resolved bean
      • getBeansOfTypeForMethodArgument

        @Internal
        protected final java.lang.Object getBeansOfTypeForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                         BeanContext context,
                                                                         int methodIndex,
                                                                         int argumentIndex)
        Obtains all bean definitions for a constructor argument at the given index.
        Parameters:
        resolutionContext - The resolution context
        context - The context
        methodIndex - The method index
        argumentIndex - The argument index
        Returns:
        The resolved bean
      • getBeansOfTypeForField

        @Internal
        protected final java.lang.Object getBeansOfTypeForField​(BeanResolutionContext resolutionContext,
                                                                BeanContext context,
                                                                int fieldIndex)
        Obtains all bean definitions for the field at the given index.
        Parameters:
        resolutionContext - The resolution context
        context - The context
        fieldIndex - The field index
        Returns:
        The resolved bean
      • getBeanRegistrationsForConstructorArgument

        @Internal
        protected final java.lang.Object getBeanRegistrationsForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                                    BeanContext context,
                                                                                    int argumentIndex)
        Obtains all bean definitions for a constructor argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        argumentIndex - The argument index
        Returns:
        The resolved bean
      • getBeanRegistrationForConstructorArgument

        @Internal
        protected final BeanRegistration<?> getBeanRegistrationForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                                      BeanContext context,
                                                                                      int argIndex)
        Obtains a bean registration for a method injection point.

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        argIndex - The arg index
        Returns:
        The resolved bean registration
      • getBeanRegistrationsForField

        @Internal
        protected final java.lang.Object getBeanRegistrationsForField​(BeanResolutionContext resolutionContext,
                                                                      BeanContext context,
                                                                      int fieldIndex)
        Obtains all bean definitions for a field injection point.

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        fieldIndex - The field index
        Returns:
        The resolved bean
      • getBeanRegistrationForField

        @Internal
        protected final BeanRegistration<?> getBeanRegistrationForField​(BeanResolutionContext resolutionContext,
                                                                        BeanContext context,
                                                                        int fieldIndex)
        Obtains a bean registration for a field injection point.

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        fieldIndex - The field index
        Returns:
        The resolved bean registration
      • getBeanRegistrationsForMethodArgument

        @Internal
        protected final java.lang.Object getBeanRegistrationsForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                               BeanContext context,
                                                                               int methodIndex,
                                                                               int argIndex)
        Obtains all bean definitions for a method injection point.

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        methodIndex - The method index
        argIndex - The arg index
        Returns:
        The resolved bean
      • getBeanRegistrationForMethodArgument

        @Internal
        protected final BeanRegistration<?> getBeanRegistrationForMethodArgument​(BeanResolutionContext resolutionContext,
                                                                                 BeanContext context,
                                                                                 int methodIndex,
                                                                                 int argIndex)
        Obtains a bean registration for a method injection point.

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        methodIndex - The method index
        argIndex - The arg index
        Returns:
        The resolved bean registration
      • streamOfTypeForConstructorArgument

        @Internal
        protected final java.util.stream.Stream streamOfTypeForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                                   BeanContext context,
                                                                                   ConstructorInjectionPoint<T> constructorInjectionPoint,
                                                                                   io.micronaut.core.type.Argument argument)
        Obtains all bean definitions for a constructor argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        constructorInjectionPoint - The constructor injection point
        argument - The argument
        Returns:
        The resolved bean
      • findBeanForConstructorArgument

        @Internal
        protected final java.util.Optional findBeanForConstructorArgument​(BeanResolutionContext resolutionContext,
                                                                          BeanContext context,
                                                                          ConstructorInjectionPoint<T> constructorInjectionPoint,
                                                                          io.micronaut.core.type.Argument argument)
        Obtains all bean definitions for a constructor argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        constructorInjectionPoint - The constructor injection point
        argument - The argument
        Returns:
        The resolved bean
      • getBeanForField

        @Internal
        protected final java.lang.Object getBeanForField​(BeanResolutionContext resolutionContext,
                                                         BeanContext context,
                                                         int fieldIndex)
        Obtains a bean definition for the field at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        fieldIndex - The field index
        Returns:
        The resolved bean
      • getValueForField

        @Internal
        protected final java.lang.Object getValueForField​(BeanResolutionContext resolutionContext,
                                                          BeanContext context,
                                                          int fieldIndex)
        Obtains a value for the given field from the bean context

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        fieldIndex - The index of the field
        Returns:
        The resolved bean
      • getValueForPath

        @Internal
        protected final <T1> java.util.Optional<T1> getValueForPath​(BeanResolutionContext resolutionContext,
                                                                    BeanContext context,
                                                                    io.micronaut.core.type.Argument<T1> propertyType,
                                                                    java.lang.String... propertyPath)
        Resolve a value for the given field of the given type and path. Only used by applications compiled with versions of Micronaut prior to 1.2.0.
        Type Parameters:
        T1 - The generic type
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        propertyType - The required property type
        propertyPath - The property path
        Returns:
        An optional value
      • getValueForPath

        @Internal
        protected final <T1> java.util.Optional<T1> getValueForPath​(BeanResolutionContext resolutionContext,
                                                                    BeanContext context,
                                                                    io.micronaut.core.type.Argument<T1> propertyType,
                                                                    java.lang.String propertyPath)
        Resolve a value for the given field of the given type and path.
        Type Parameters:
        T1 - The generic type
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        propertyType - The required property type
        propertyPath - The property path
        Returns:
        An optional value
      • containsValueForField

        @Internal
        protected final boolean containsValueForField​(BeanResolutionContext resolutionContext,
                                                      BeanContext context,
                                                      int fieldIndex)
        Obtains a value for the given field argument.
        Parameters:
        resolutionContext - The resolution context
        context - The bean context
        fieldIndex - The field index
        Returns:
        True if it does
      • containsProperties

        @Internal
        protected final boolean containsProperties​(BeanResolutionContext resolutionContext,
                                                   BeanContext context)
        If this bean is a ConfigurationProperties bean return whether any properties for it are configured within the context.
        Parameters:
        resolutionContext - the resolution context
        context - The context
        Returns:
        True if it does
      • containsProperties

        @Internal
        protected final boolean containsProperties​(BeanResolutionContext resolutionContext,
                                                   BeanContext context,
                                                   java.lang.String subProperty)
        If this bean is a ConfigurationProperties bean return whether any properties for it are configured within the context.
        Parameters:
        resolutionContext - the resolution context
        context - The context
        subProperty - The subproperty to check
        Returns:
        True if it does
      • findBeanForField

        @Internal
        protected final java.util.Optional findBeanForField​(BeanResolutionContext resolutionContext,
                                                            BeanContext context,
                                                            FieldInjectionPoint injectionPoint)
        Obtains a an optional for the field at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        injectionPoint - The field injection point
        Returns:
        The resolved bean
      • getBeansOfTypeForField

        @Internal
        protected final java.util.Collection getBeansOfTypeForField​(BeanResolutionContext resolutionContext,
                                                                    BeanContext context,
                                                                    FieldInjectionPoint injectionPoint)
        Obtains a bean definition for the field at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        injectionPoint - The field injection point
        Returns:
        The resolved bean
      • getStreamOfTypeForField

        @Internal
        protected final java.util.stream.Stream getStreamOfTypeForField​(BeanResolutionContext resolutionContext,
                                                                        BeanContext context,
                                                                        FieldInjectionPoint injectionPoint)
        Obtains a bean definition for the field at the given index and the argument at the given index

        Warning: this method is used by internal generated code and should not be called by user code.

        Parameters:
        resolutionContext - The resolution context
        context - The context
        injectionPoint - The field injection point
        Returns:
        The resolved bean
      • getTypeArgumentsMap

        @Internal
        protected java.util.Map<java.lang.String,​io.micronaut.core.type.Argument<?>[]> getTypeArgumentsMap()
        A method that subclasses can override to provide information on type arguments.
        Returns:
        The type arguments
      • resolveAnnotationMetadata

        protected io.micronaut.core.annotation.AnnotationMetadata resolveAnnotationMetadata()
        Resolves the annotation metadata for this bean. Subclasses
        Returns:
        The AnnotationMetadata