Class AbstractInitializableBeanDefinition<T>

java.lang.Object
io.micronaut.context.AbstractInitializableBeanDefinition<T>
Type Parameters:
T - The Bean definition type
All Implemented Interfaces:
EnvironmentConfigurable, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, BeanInfo<T>, Named, ArgumentCoercible<T>, BeanContextConditional, BeanDefinition<T>, BeanType<T>, InjectableBeanDefinition<T>, InstantiatableBeanDefinition<T>, QualifiedBeanType<T>

@Internal public abstract class AbstractInitializableBeanDefinition<T> extends Object implements InstantiatableBeanDefinition<T>, InjectableBeanDefinition<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 io.micronaut.inject.writer.BeanDefinitionWriter class can be used to produce bean definitions at compile or runtime

Since:
3.0
Author:
Graeme Rocher, Denis Stepanov
  • Constructor Details

  • Method Details

    • isConfigurationProperties

      public final boolean isConfigurationProperties()
      Specified by:
      isConfigurationProperties in interface BeanDefinition<T>
      Returns:
      Is the type configuration properties.
    • getDeclaredQualifier

      public Qualifier<T> getDeclaredQualifier()
      Description copied from interface: BeanDefinition
      Resolve the declared qualifier for this bean.
      Specified by:
      getDeclaredQualifier in interface BeanDefinition<T>
      Specified by:
      getDeclaredQualifier in interface QualifiedBeanType<T>
      Returns:
      The qualifier or null if this isn't one
    • isContainerType

      public final boolean isContainerType()
      Description copied from interface: BeanType
      Checks whether the bean type is a container type.
      Specified by:
      isContainerType in interface BeanType<T>
      Returns:
      Whether the type is a container type like Iterable.
    • getContainerElement

      public final Optional<Argument<?>> getContainerElement()
      Description copied from interface: BeanDefinition
      If BeanType.isContainerType() returns true this will return the container element.
      Specified by:
      getContainerElement in interface BeanDefinition<T>
      Returns:
      The container element.
    • hasPropertyExpressions

      public final boolean hasPropertyExpressions()
      Description copied from interface: AnnotationMetadata
      Does the metadata contain any property expressions like ${foo.bar}. Note this by default returns true as previous versions of Micronaut must assume metadata is present. The compilation time this is computed in order to decide whether to instrument annotation metadata with environment specific logic.
      Specified by:
      hasPropertyExpressions in interface AnnotationMetadata
      Specified by:
      hasPropertyExpressions in interface AnnotationMetadataDelegate
      Specified by:
      hasPropertyExpressions in interface EnvironmentConfigurable
      Returns:
      True if property expressions are present
    • getTypeArguments

      @NonNull public final List<Argument<?>> getTypeArguments(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 AnnotationMetadata getAnnotationMetadata()
      Description copied from interface: AnnotationMetadataProvider
      Supplies the metadata. Defaults to AnnotationMetadata.EMPTY_METADATA.
      Specified by:
      getAnnotationMetadata in interface AnnotationMetadataProvider
      Returns:
      The AnnotationMetadata
    • isAbstract

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

      public boolean isIterable()
      Specified by:
      isIterable in interface BeanDefinition<T>
      Returns:
      Whether the bean declared with EachProperty or EachBean
    • isPrimary

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

      public boolean requiresMethodProcessing()
      Description copied from interface: BeanType
      By default, when the BeanContext is started, the BeanDefinition.getExecutableMethods() are not processed by registered ExecutableMethodProcessor instances unless this method returns true.
      Specified by:
      requiresMethodProcessing in interface BeanType<T>
      Returns:
      Whether the bean definition requires method processing
      See Also:
    • findMethod

      public final <R> Optional<ExecutableMethod<T,R>> findMethod(String name, 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 final <R> Stream<ExecutableMethod<T,R>> findPossibleMethods(String name)
      Description copied from interface: BeanDefinition
      Finds possible methods for the given method name.
      Specified by:
      findPossibleMethods in interface BeanDefinition<T>
      Type Parameters:
      R - The return type
      Parameters:
      name - The method name
      Returns:
      The possible methods
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface BeanDefinition<T>
      Returns:
      Whether the scope is singleton
    • getScope

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

      public final Optional<String> getScopeName()
      Specified by:
      getScopeName in interface BeanDefinition<T>
      Returns:
      The name of the scope
    • getBeanType

      public final Class<T> getBeanType()
      Description copied from interface: BeanType
      Returns the bean type.
      Specified by:
      getBeanType in interface BeanDefinition<T>
      Specified by:
      getBeanType in interface BeanInfo<T>
      Specified by:
      getBeanType in interface BeanType<T>
      Returns:
      The produced bean type
    • getExposedTypes

      @NonNull public Set<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 Optional<Class<?>> getDeclaringType()
      Specified by:
      getDeclaringType in interface BeanDefinition<T>
      Returns:
      The type that declares this definition, null if not applicable.
    • getConstructor

      public final ConstructorInjectionPoint<T> getConstructor()
      Description copied from interface: BeanDefinition
      The single concrete constructor that is an injection point for creating the bean.
      Specified by:
      getConstructor in interface BeanDefinition<T>
      Returns:
      The constructor injection point
    • getRequiredComponents

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

      public final List<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
    • getInjectedFields

      public final List<FieldInjectionPoint<T,?>> getInjectedFields()
      Description copied from interface: BeanDefinition
      All the fields that require injection.
      Specified by:
      getInjectedFields in interface BeanDefinition<T>
      Returns:
      The required fields
    • getPostConstructMethods

      public final List<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
    • getPreDestroyMethods

      public final List<MethodInjectionPoint<T,?>> getPreDestroyMethods()
      Description copied from interface: BeanDefinition
      All the methods that should be called when the object is to be destroyed.
      Specified by:
      getPreDestroyMethods in interface BeanDefinition<T>
      Returns:
      Methods to call pre-destroy
    • getName

      @NonNull public final String getName()
      Specified by:
      getName in interface BeanDefinition<T>
      Specified by:
      getName in interface BeanType<T>
      Specified by:
      getName in interface Named
      Returns:
      The class name
    • inject

      @Deprecated(since="4") @NextMajorVersion("Remove after Micronaut 4 Milestone 1. I think we always implement this method so it\'s not needed, otherwise un-deprecate") public T inject(BeanContext context, T bean)
      Deprecated.
      Description copied from interface: InjectableBeanDefinition
      Inject the given bean with the context.
      Specified by:
      inject in interface InjectableBeanDefinition<T>
      Parameters:
      context - The context
      bean - The bean
      Returns:
      The injected bean
    • inject

      @Deprecated(since="4") @NextMajorVersion("Remove after Micronaut 4 Milestone 1. I think we always implement this method so it\'s not needed, otherwise un-deprecate") public T inject(BeanResolutionContext resolutionContext, BeanContext context, T bean)
      Deprecated.
      Description copied from interface: InjectableBeanDefinition
      Inject the given bean with the context.
      Specified by:
      inject in interface InjectableBeanDefinition<T>
      Parameters:
      resolutionContext - the resolution context
      context - The context
      bean - The bean
      Returns:
      The injected bean
    • getExecutableMethods

      public final Collection<ExecutableMethod<T,?>> getExecutableMethods()
      Specified by:
      getExecutableMethods in interface BeanDefinition<T>
      Returns:
      The ExecutableMethod instances for this definition
    • 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(String message)
      Allows printing warning messages produced by the compiler.
      Parameters:
      message - The message
    • warnMissingProperty

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

      public final Argument<?>[] getRequiredArguments()
      Returns:
      The arguments required to construct parametrized bean
    • build

      @Deprecated(since="4") @NextMajorVersion("Should be removed after Micronaut 4 Milestone 1") public final T build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, Map<String,Object> requiredArgumentValues) throws BeanInstantiationException
      Deprecated.
      Parameters:
      resolutionContext - The BeanResolutionContext
      context - The BeanContext
      definition - The BeanDefinition
      requiredArgumentValues - The required arguments values. The keys should match the names of the arguments returned by getRequiredArguments()
      Returns:
      The instantiated bean
      Throws:
      BeanInstantiationException - If the bean cannot be instantiated for the arguments supplied
    • doBuild

      @Internal @Deprecated(since="4") @NextMajorVersion("Should be removed after Micronaut 4 Milestone 1") protected T doBuild(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, Map<String,Object> requiredArgumentValues)
      Deprecated.
      Method to be implemented by the generated code if the bean definition is implementing ParametrizedBeanFactory.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      definition - The bean definition
      requiredArgumentValues - The required arguments
      Returns:
      The built instance
    • instantiate

      public final T instantiate(BeanResolutionContext resolutionContext, BeanContext context, Map<String,Object> requiredArgumentValues) throws BeanInstantiationException
      Parameters:
      resolutionContext - The BeanResolutionContext
      context - The BeanContext
      requiredArgumentValues - The required arguments values. The keys should match the names of the arguments returned by getRequiredArguments()
      Returns:
      The instantiated bean
      Throws:
      BeanInstantiationException - If the bean cannot be instantiated for the arguments supplied
    • doInstantiate

      @Internal protected T doInstantiate(BeanResolutionContext resolutionContext, BeanContext context, Map<String,Object> requiredArgumentValues)
      Method to be implemented by the generated code if the bean definition is implementing ParametrizedBeanFactory.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      requiredArgumentValues - The required arguments
      Returns:
      The built instance
    • injectBean

      @Internal @Deprecated(since="4") @NextMajorVersion("Remove after Micronaut 4 Milestone 1") protected Object injectBean(BeanResolutionContext resolutionContext, BeanContext context, Object bean)
      Deprecated.
      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
    • postConstruct

      @Internal protected Object postConstruct(BeanResolutionContext resolutionContext, BeanContext context, 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

      @Internal protected Object preDestroy(BeanResolutionContext resolutionContext, BeanContext context, 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
    • isInnerConfiguration

      @Internal protected boolean isInnerConfiguration(Class<?> clazz)
      Check if the class is an inner configuration.
      Parameters:
      clazz - The class to check
      Returns:
      true if the inner configuration
    • checkIfShouldLoad

      @Internal protected void checkIfShouldLoad(BeanResolutionContext resolutionContext, BeanContext context)
      Checks whether the bean should be loaded.
      Parameters:
      resolutionContext - - the resolution context
      context - - the bean context
    • checkInjectedBeanPropertyValue

      @Internal protected final void checkInjectedBeanPropertyValue(String injectedBeanPropertyName, @Nullable Object beanPropertyValue, @Nullable String requiredValue, @Nullable String notEqualsValue)
      Check the value of the injected bean property to decide whether the bean should be loaded.
      Parameters:
      injectedBeanPropertyName - the name of the injected bean property
      beanPropertyValue - the value of injected bean property
      requiredValue - the value which is required for the bean to be loaded
      notEqualsValue - the value which bean property should not be equal to for the bean to be loaded
    • invokeMethodWithReflection

      @Internal protected final void invokeMethodWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, Object bean, Object[] methodArgs)
      Invoke a bean method that requires reflection.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      methodIndex - The method index
      bean - The bean
      methodArgs - The method args
    • setFieldWithReflection

      @Internal protected final void setFieldWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int index, Object object, Object value)
      Sets the value of a field of a object that requires reflection.
      Parameters:
      resolutionContext - The resolution context
      context - The object context
      index - The index of the field
      object - The object whose field should be modifie
      value - The instance being set
    • getValueForMethodArgument

      @Internal @Deprecated protected final Object getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Qualifier qualifier)
      Deprecated.
      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
      qualifier - The qualifier
      Returns:
      The value
    • getPropertyValueForMethodArgument

      @Internal protected final Object getPropertyValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, String propertyValue, String cliProperty)
      Obtains a property value for the given method argument.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      methodIndex - The method index
      argIndex - The argument index
      propertyValue - The property value
      cliProperty - The cli property
      Returns:
      The value
    • getPropertyPlaceholderValueForMethodArgument

      @Internal protected final Object getPropertyPlaceholderValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, String value)
      Obtains a placeholder value for the given method argument.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      methodIndex - The method index
      argIndex - The argument index
      value - The property value
      Returns:
      The value
    • getPropertyValueForSetter

      @Internal protected final Object getPropertyValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument<?> argument, String propertyValue, String cliProperty)
      Obtains a property value for the given method argument.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      setterName - The setter name
      argument - The argument
      propertyValue - The property value
      cliProperty - The cli property
      Returns:
      The value
    • getPropertyPlaceholderValueForSetter

      @Internal protected final Object getPropertyPlaceholderValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument<?> argument, String value)
      Obtains a placeholder value for the given method argument.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      setterName - The setter name
      argument - The argument
      value - The value
      Returns:
      The value
    • containsValueForMethodArgument

      @Internal @Deprecated protected final boolean containsValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, boolean isValuePrefix)
      Deprecated.
      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
      isValuePrefix - Is value prefix in cases when beans are requested
      Returns:
      The value
    • getBeanForMethodArgument

      @Internal protected final <K> K getBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Qualifier<K> qualifier)
      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.

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

      @Internal protected final <K, R extends Collection<K>> R getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argumentIndex, Argument<K> genericType, Qualifier<K> qualifier)
      Obtains all bean definitions for a method argument at the given index.
      Type Parameters:
      K - The bean type
      R - The result collection type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      methodIndex - The method index
      argumentIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanForSetter

      @Internal protected final Object getBeanForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument argument, Qualifier qualifier)
      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
      setterName - The setter name
      argument - The argument
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeansOfTypeForSetter

      @Internal protected final Collection<Object> getBeansOfTypeForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument argument, Argument genericType, Qualifier qualifier)
      Obtains all bean definitions for a method argument at the given index.
      Parameters:
      resolutionContext - The resolution context
      context - The context
      setterName - The setter name
      argument - The argument
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • findBeanForMethodArgument

      @Internal protected final <K> Optional<K> findBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      methodIndex - The method index
      argIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getStreamOfTypeForMethodArgument

      @Internal protected final Stream<?> getStreamOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument genericType, Qualifier qualifier)
      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
      methodIndex - The method index
      argIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getMapOfTypeForMethodArgument

      @Internal protected final <V> Map<String,V> getMapOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument<V> genericType, Qualifier<V> qualifier)
      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.

      Type Parameters:
      V - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      methodIndex - The method index
      argIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanForConstructorArgument

      @Internal protected final Object getBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
      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
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getValueForConstructorArgument

      @Internal @Deprecated protected final Object getValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
      Deprecated.
      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
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getPropertyValueForConstructorArgument

      @Internal protected final Object getPropertyValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, String propertyValue, String cliProperty)
      Obtains a property 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
      propertyValue - The property value
      cliProperty - The cli property
      Returns:
      The resolved bean
    • getPropertyPlaceholderValueForConstructorArgument

      @Internal protected final Object getPropertyPlaceholderValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, String propertyValue)
      Obtains a property 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
      propertyValue - The property value
      Returns:
      The resolved bean
    • getBeansOfTypeForConstructorArgument

      @Internal protected final Collection<Object> getBeansOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, Argument genericType, Qualifier qualifier)
      Obtains all bean definitions for a constructor argument at the given index.
      Parameters:
      resolutionContext - The resolution context
      context - The context
      argumentIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanRegistrationsForConstructorArgument

      @Internal protected final <K, R extends Collection<BeanRegistration<K>>> R getBeanRegistrationsForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      R - The result collection type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      argumentIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanRegistrationForConstructorArgument

      @Internal protected final <K> BeanRegistration<K> getBeanRegistrationForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      argumentIndex - The arg index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean registration
    • getBeanRegistrationsForMethodArgument

      @Internal protected final <K, R extends Collection<BeanRegistration<K>>> R getBeanRegistrationsForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      R - The result collection type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      methodIndex - The method index
      argIndex - The arg index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanRegistrationForMethodArgument

      @Internal protected final <K> BeanRegistration<K> getBeanRegistrationForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      methodIndex - The method index
      argIndex - The arg index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean registration
    • getStreamOfTypeForConstructorArgument

      @Internal protected final <K> Stream<K> getStreamOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      argIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getMapOfTypeForConstructorArgument

      @Internal protected final <V> Map<String,V> getMapOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Argument<V> genericType, Qualifier<V> qualifier)
      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.

      Type Parameters:
      V - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      argIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • findBeanForConstructorArgument

      @Internal protected final <K> Optional<K> findBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      argIndex - The argument index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanForField

      @Internal protected final <K> K getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanForAnnotation

      @Internal protected final <K> K getBeanForAnnotation(BeanResolutionContext resolutionContext, BeanContext context, int annotationBeanIndex, Qualifier<K> qualifier)
    • getValueForField

      @Internal @Deprecated protected final Object getValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Qualifier qualifier)
      Deprecated.
      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
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getPropertyValueForField

      @Internal @Deprecated protected final Object getPropertyValueForField(BeanResolutionContext resolutionContext, BeanContext context, Argument argument, String propertyValue, String cliProperty)
      Deprecated.
      Obtains a property 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
      argument - The argument
      propertyValue - The property value
      cliProperty - The clie property name
      Returns:
      The resolved bean
    • getPropertyPlaceholderValueForField

      @Internal @Deprecated protected final Object getPropertyPlaceholderValueForField(BeanResolutionContext resolutionContext, BeanContext context, Argument argument, String placeholder)
      Deprecated.
      Obtains a property placeholder 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
      argument - The argument
      placeholder - The placeholder
      Returns:
      The resolved bean
    • getValueForPath

      @Internal protected final <T1> Optional<T1> getValueForPath(BeanResolutionContext resolutionContext, BeanContext context, Argument<T1> propertyType, 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 @Deprecated protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, boolean isValuePrefix)
      Deprecated.
      Obtains a value for the given field argument.
      Parameters:
      resolutionContext - The resolution context
      context - The bean context
      fieldIndex - The field index
      isValuePrefix - Is value prefix in cases when beans are requested
      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, 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
    • getBeansOfTypeForField

      @Internal protected final <K, R extends Collection<K>> Object getBeansOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument<K> genericType, Qualifier<K> qualifier)
      Obtains all bean definitions for the field at the given index.
      Type Parameters:
      K - The bean type
      R - The result collection type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanRegistrationsForField

      @Internal protected final <K, R extends Collection<BeanRegistration<K>>> R getBeanRegistrationsForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      R - The result collection type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getBeanRegistrationForField

      @Internal protected final <K> BeanRegistration<K> getBeanRegistrationForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean registration
    • findBeanForField

      @Internal protected final <K> Optional<K> findBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getStreamOfTypeForField

      @Internal protected final <K> Stream<K> getStreamOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument<K> genericType, Qualifier<K> qualifier)
      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.

      Type Parameters:
      K - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • getMapOfTypeForField

      @Internal protected final <V> Map<String,V> getMapOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument<V> genericType, Qualifier<V> qualifier)
      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.

      Type Parameters:
      V - The bean type
      Parameters:
      resolutionContext - The resolution context
      context - The context
      fieldIndex - The field index
      genericType - The generic type
      qualifier - The qualifier
      Returns:
      The resolved bean
    • containsPropertiesValue

      @Internal protected final boolean containsPropertiesValue(BeanResolutionContext resolutionContext, BeanContext context, String value)
    • containsPropertyValue

      @Internal protected final boolean containsPropertyValue(BeanResolutionContext resolutionContext, BeanContext context, String value)
    • isEnabled

      public boolean isEnabled(@NonNull BeanContext context, @Nullable BeanResolutionContext resolutionContext)
      Description copied from interface: BeanContextConditional
      Return whether this component is enabled for the given context.
      Specified by:
      isEnabled in interface BeanContextConditional
      Parameters:
      context - The context
      resolutionContext - The bean resolution context
      Returns:
      True if it is