Class AbstractInitializableBeanDefinition<T>
- java.lang.Object
-
- io.micronaut.context.AbstractInitializableBeanDefinition<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>
@Internal public class AbstractInitializableBeanDefinition<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:
- 3.0
- See Also:
BeanDefinitionWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractInitializableBeanDefinition.AnnotationReference
The data class containing annotation injection information.static class
AbstractInitializableBeanDefinition.FieldReference
The data class containing all filed reference information.static class
AbstractInitializableBeanDefinition.MethodOrFieldReference
The shared data class between method and field reference.static class
AbstractInitializableBeanDefinition.MethodReference
The data class containing all method reference information.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractInitializableBeanDefinition(java.lang.Class<T> beanType, AbstractInitializableBeanDefinition.MethodOrFieldReference constructor, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractInitializableBeanDefinition.MethodReference[] methodInjection, AbstractInitializableBeanDefinition.FieldReference[] fieldInjection, AbstractInitializableBeanDefinition.AnnotationReference[] annotationInjection, ExecutableMethodsDefinition<T> executableMethodsDefinition, java.util.Map<java.lang.String,io.micronaut.core.type.Argument<?>[]> typeArgumentsMap, java.util.Optional<java.lang.String> scope, boolean isAbstract, boolean isProvided, boolean isIterable, boolean isSingleton, boolean isPrimary, boolean isConfigurationProperties, boolean isContainerType, boolean requiresMethodProcessing)
protected
AbstractInitializableBeanDefinition(java.lang.Class<T> beanType, AbstractInitializableBeanDefinition.MethodOrFieldReference constructor, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractInitializableBeanDefinition.MethodReference[] methodInjection, AbstractInitializableBeanDefinition.FieldReference[] fieldInjection, ExecutableMethodsDefinition<T> executableMethodsDefinition, java.util.Map<java.lang.String,io.micronaut.core.type.Argument<?>[]> typeArgumentsMap, java.util.Optional<java.lang.String> scope, boolean isAbstract, boolean isProvided, boolean isIterable, boolean isSingleton, boolean isPrimary, boolean isConfigurationProperties, boolean isContainerType, boolean requiresMethodProcessing)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description T
build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues)
Implementing possibleParametrizedBeanFactory.build(BeanResolutionContext, BeanContext, BeanDefinition)
.protected void
checkIfShouldLoad(BeanResolutionContext resolutionContext, BeanContext context)
Checks whether the bean should be loaded.protected void
checkInjectedBeanPropertyValue(java.lang.String injectedBeanPropertyName, java.lang.Object beanPropertyValue, java.lang.String requiredValue, java.lang.String notEqualsValue)
Check the value of the injected bean property to decide whether the bean should be loaded.void
configure(Environment environment)
Configures the bean for the givenBeanContext
.protected boolean
containsProperties(BeanResolutionContext resolutionContext, BeanContext context)
If this bean is aConfigurationProperties
bean return whether any properties for it are configured within the context.protected boolean
containsProperties(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String subProperty)
If this bean is aConfigurationProperties
bean return whether any properties for it are configured within the context.protected boolean
containsPropertiesValue(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String value)
protected boolean
containsPropertyValue(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String value)
protected boolean
containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, boolean isValuePrefix)
Deprecated.protected boolean
containsValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, boolean isValuePrefix)
Deprecated.protected T
doBuild(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues)
Method to be implemented by the generated code if the bean definition is implementingParametrizedBeanFactory
.boolean
equals(java.lang.Object o)
protected <K> java.util.Optional<K>
findBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a constructor argument at the given indexprotected <K> java.util.Optional<K>
findBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a an optional for the field at the given index and the argument at the given indexprotected <K> java.util.Optional<K>
findBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains an optional bean for the method at the given index and the argument at the given index<R> java.util.Optional<ExecutableMethod<T,R>>
findMethod(java.lang.String name, java.lang.Class<?>... argumentTypes)
Finds a singleExecutableMethod
for the given name and argument types.<R> java.util.stream.Stream<ExecutableMethod<T,R>>
findPossibleMethods(java.lang.String name)
Finds possible methods for the given method name.io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
protected <K> K
getBeanForAnnotation(BeanResolutionContext resolutionContext, BeanContext context, int annotationBeanIndex, Qualifier<K> qualifier)
protected java.lang.Object
getBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
Obtains a bean definition for a constructor at the given indexprotected <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 indexprotected <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 indexprotected java.lang.Object
getBeanForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument argument, Qualifier qualifier)
Obtains a bean definition for the method at the given index and the argument at the given indexprotected <K> BeanRegistration<K>
getBeanRegistrationForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a bean registration for a method injection point.protected <K> BeanRegistration<K>
getBeanRegistrationForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a bean registration for a field injection point.protected <K> BeanRegistration<K>
getBeanRegistrationForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a bean registration for a method injection point.protected <K,R extends java.util.Collection<BeanRegistration<K>>>
RgetBeanRegistrationsForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a constructor argument at the given indexprotected <K,R extends java.util.Collection<BeanRegistration<K>>>
RgetBeanRegistrationsForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a field injection point.protected <K,R extends java.util.Collection<BeanRegistration<K>>>
RgetBeanRegistrationsForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a method injection point.protected java.util.Collection<java.lang.Object>
getBeansOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, io.micronaut.core.type.Argument genericType, Qualifier qualifier)
Obtains all bean definitions for a constructor argument at the given index.protected <K,R extends java.util.Collection<K>>
java.lang.ObjectgetBeansOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for the field at the given index.protected <K,R extends java.util.Collection<K>>
RgetBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argumentIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a method argument at the given index.protected java.util.Collection<java.lang.Object>
getBeansOfTypeForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument argument, io.micronaut.core.type.Argument genericType, Qualifier qualifier)
Obtains all bean definitions for a method argument at the given index.java.lang.Class<T>
getBeanType()
Returns the bean type.ConstructorInjectionPoint<T>
getConstructor()
The single concrete constructor that is an injection point for creating the bean.java.util.Optional<io.micronaut.core.type.Argument<?>>
getContainerElement()
IfBeanType.isContainerType()
returns true this will return the container element.Qualifier<T>
getDeclaredQualifier()
Resolve the declared qualifier for this bean.java.util.Optional<java.lang.Class<?>>
getDeclaringType()
java.util.Collection<ExecutableMethod<T,?>>
getExecutableMethods()
java.util.Set<java.lang.Class<?>>
getExposedTypes()
Returns a potentially limited subset of bean types exposed by this bean.java.util.List<FieldInjectionPoint<T,?>>
getInjectedFields()
All the fields that require injection.java.util.List<MethodInjectionPoint<T,?>>
getInjectedMethods()
All methods that require injection.java.lang.String
getName()
java.util.List<MethodInjectionPoint<T,?>>
getPostConstructMethods()
All the methods that should be called once the bean has been fully initialized and constructed.java.util.List<MethodInjectionPoint<T,?>>
getPreDestroyMethods()
All the methods that should be called when the object is to be destroyed.protected java.lang.Object
getPropertyPlaceholderValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, java.lang.String propertyValue)
Obtains a property value for a bean definition for a constructor at the given indexprotected java.lang.Object
getPropertyPlaceholderValueForField(BeanResolutionContext resolutionContext, BeanContext context, io.micronaut.core.type.Argument argument, java.lang.String placeholder)
Deprecated.protected java.lang.Object
getPropertyPlaceholderValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, java.lang.String value)
Obtains a placeholder value for the given method argument.protected java.lang.Object
getPropertyPlaceholderValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument<?> argument, java.lang.String value)
Obtains a placeholder value for the given method argument.protected java.lang.Object
getPropertyValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, java.lang.String propertyValue, java.lang.String cliProperty)
Obtains a property value for a bean definition for a constructor at the given indexprotected java.lang.Object
getPropertyValueForField(BeanResolutionContext resolutionContext, BeanContext context, io.micronaut.core.type.Argument argument, java.lang.String propertyValue, java.lang.String cliProperty)
Deprecated.protected java.lang.Object
getPropertyValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, java.lang.String propertyValue, java.lang.String cliProperty)
Obtains a property value for the given method argument.protected java.lang.Object
getPropertyValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument<?> argument, java.lang.String propertyValue, java.lang.String cliProperty)
Obtains a property value for the given method argument.protected java.lang.Object
getProxiedBean(BeanContext beanContext)
Resolves the proxied bean instance for this bean.io.micronaut.core.type.Argument<?>[]
getRequiredArguments()
Implementing possibleParametrizedBeanFactory.getRequiredArguments()
.java.util.Collection<java.lang.Class<?>>
getRequiredComponents()
java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getScope()
java.util.Optional<java.lang.String>
getScopeName()
protected <K> java.util.stream.Stream<K>
getStreamOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a constructor argument at the given indexprotected <K> java.util.stream.Stream<K>
getStreamOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a bean definition for the field at the given index and the argument at the given indexprotected java.util.stream.Stream<?>
getStreamOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.Argument genericType, Qualifier qualifier)
Obtains all bean definitions for the method at the given index and the argument at the given indexjava.util.List<io.micronaut.core.type.Argument<?>>
getTypeArguments(java.lang.String type)
Return the type arguments for the given interface or super type for this bean.protected java.lang.Object
getValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
Deprecated.protected java.lang.Object
getValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Qualifier qualifier)
Deprecated.protected java.lang.Object
getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Qualifier qualifier)
Deprecated.protected <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.int
hashCode()
boolean
hasPropertyExpressions()
T
inject(BeanContext context, T bean)
Inject the given bean with the context.T
inject(BeanResolutionContext resolutionContext, BeanContext context, T bean)
Inject the given bean with the context.protected java.lang.Object
injectAnother(BeanResolutionContext resolutionContext, BeanContext context, java.lang.Object bean)
Inject another bean, for example one created via factory.protected java.lang.Object
injectBean(BeanResolutionContext resolutionContext, BeanContext context, java.lang.Object bean)
The default implementation which provides no injection.protected void
invokeMethodWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, java.lang.Object bean, java.lang.Object[] methodArgs)
Invoke a bean method that requires reflection.boolean
isAbstract()
boolean
isContainerType()
Checks whether the bean type is a container type.boolean
isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.protected boolean
isInnerConfiguration(java.lang.Class<?> clazz)
Check if the class is an inner configuration.boolean
isIterable()
boolean
isPrimary()
boolean
isProvided()
boolean
isSingleton()
protected java.lang.Object
postConstruct(BeanResolutionContext resolutionContext, BeanContext context, java.lang.Object bean)
Default postConstruct hook that only invokes methods that require reflection.protected java.lang.Object
preDestroy(BeanResolutionContext resolutionContext, BeanContext context, java.lang.Object bean)
Default preDestroy hook that only invokes methods that require reflection.boolean
requiresMethodProcessing()
By default, when theBeanContext
is started, theBeanDefinition.getExecutableMethods()
are not processed by registeredExecutableMethodProcessor
instances unless this method returns true.protected void
setFieldWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int index, java.lang.Object object, java.lang.Object value)
Sets the value of a field of a object that requires reflection.java.lang.String
toString()
protected void
warn(java.lang.String message)
Allows printing warning messages produced by the compiler.protected void
warnMissingProperty(java.lang.Class type, java.lang.String method, java.lang.String property)
Allows printing warning messages produced by the compiler.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.inject.BeanContextConditional
isEnabled, isEnabled
-
Methods inherited from interface io.micronaut.inject.BeanDefinition
asArgument, getRequiredMethod, getTypeArguments, getTypeArguments, getTypeParameters, getTypeParameters, isCandidateBean, isProxy, resolveDynamicQualifier
-
-
-
-
Constructor Detail
-
AbstractInitializableBeanDefinition
@Internal protected AbstractInitializableBeanDefinition(java.lang.Class<T> beanType, @Nullable AbstractInitializableBeanDefinition.MethodOrFieldReference constructor, @Nullable io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @Nullable AbstractInitializableBeanDefinition.MethodReference[] methodInjection, @Nullable AbstractInitializableBeanDefinition.FieldReference[] fieldInjection, @Nullable ExecutableMethodsDefinition<T> executableMethodsDefinition, @Nullable java.util.Map<java.lang.String,io.micronaut.core.type.Argument<?>[]> typeArgumentsMap, java.util.Optional<java.lang.String> scope, boolean isAbstract, boolean isProvided, boolean isIterable, boolean isSingleton, boolean isPrimary, boolean isConfigurationProperties, boolean isContainerType, boolean requiresMethodProcessing)
-
AbstractInitializableBeanDefinition
@Internal protected AbstractInitializableBeanDefinition(java.lang.Class<T> beanType, @Nullable AbstractInitializableBeanDefinition.MethodOrFieldReference constructor, @Nullable io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @Nullable AbstractInitializableBeanDefinition.MethodReference[] methodInjection, @Nullable AbstractInitializableBeanDefinition.FieldReference[] fieldInjection, @Nullable AbstractInitializableBeanDefinition.AnnotationReference[] annotationInjection, @Nullable ExecutableMethodsDefinition<T> executableMethodsDefinition, @Nullable java.util.Map<java.lang.String,io.micronaut.core.type.Argument<?>[]> typeArgumentsMap, java.util.Optional<java.lang.String> scope, boolean isAbstract, boolean isProvided, boolean isIterable, boolean isSingleton, boolean isPrimary, boolean isConfigurationProperties, boolean isContainerType, boolean requiresMethodProcessing)
-
-
Method Detail
-
getDeclaredQualifier
public Qualifier<T> getDeclaredQualifier()
Description copied from interface:BeanDefinition
Resolve the declared qualifier for this bean.- Specified by:
getDeclaredQualifier
in interfaceBeanDefinition<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 interfaceBeanType<T>
- Returns:
- Whether the type is a container type like
Iterable
.
-
getContainerElement
public final java.util.Optional<io.micronaut.core.type.Argument<?>> getContainerElement()
Description copied from interface:BeanDefinition
IfBeanType.isContainerType()
returns true this will return the container element.- Specified by:
getContainerElement
in interfaceBeanDefinition<T>
- Returns:
- The container element.
-
hasPropertyExpressions
public final boolean hasPropertyExpressions()
- Specified by:
hasPropertyExpressions
in interfaceio.micronaut.core.annotation.AnnotationMetadata
- Specified by:
hasPropertyExpressions
in interfaceio.micronaut.core.annotation.AnnotationMetadataDelegate
- Specified by:
hasPropertyExpressions
in interfaceEnvironmentConfigurable
- Returns:
- Whether any environment specific property expressions exist in the object.
-
getTypeArguments
@NonNull public final 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 interfaceBeanDefinition<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 interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstract
in interfaceBeanDefinition<T>
- Returns:
- Whether the bean definition is abstract
-
isIterable
public boolean isIterable()
- Specified by:
isIterable
in interfaceBeanDefinition<T>
- Returns:
- Whether the bean declared with
EachProperty
orEachBean
-
isPrimary
public boolean isPrimary()
-
isProvided
public boolean isProvided()
- Specified by:
isProvided
in interfaceBeanDefinition<T>
- Returns:
- Is this definition provided by another bean
- See Also:
Provided
-
requiresMethodProcessing
public boolean requiresMethodProcessing()
Description copied from interface:BeanType
By default, when theBeanContext
is started, theBeanDefinition.getExecutableMethods()
are not processed by registeredExecutableMethodProcessor
instances unless this method returns true.- Specified by:
requiresMethodProcessing
in interfaceBeanType<T>
- Returns:
- Whether the bean definition requires method processing
- See Also:
Executable.processOnStartup()
-
findMethod
public final <R> java.util.Optional<ExecutableMethod<T,R>> findMethod(java.lang.String name, java.lang.Class<?>... argumentTypes)
Description copied from interface:BeanDefinition
Finds a singleExecutableMethod
for the given name and argument types.- Specified by:
findMethod
in interfaceBeanDefinition<T>
- Type Parameters:
R
- The return type- Parameters:
name
- The method nameargumentTypes
- The argument types- Returns:
- An optional
ExecutableMethod
-
findPossibleMethods
public final <R> java.util.stream.Stream<ExecutableMethod<T,R>> findPossibleMethods(java.lang.String name)
Description copied from interface:BeanDefinition
Finds possible methods for the given method name.- Specified by:
findPossibleMethods
in interfaceBeanDefinition<T>
- Type Parameters:
R
- The return type- Parameters:
name
- The method name- Returns:
- The possible methods
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceBeanDefinition<T>
- Returns:
- Whether the scope is singleton
-
getScope
public final java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getScope()
- Specified by:
getScope
in interfaceBeanDefinition<T>
- Returns:
- The scope of the bean
-
getScopeName
public final java.util.Optional<java.lang.String> getScopeName()
- Specified by:
getScopeName
in interfaceBeanDefinition<T>
- Returns:
- The name of the scope
-
getBeanType
public final java.lang.Class<T> getBeanType()
Description copied from interface:BeanType
Returns the bean type.- Specified by:
getBeanType
in interfaceBeanDefinition<T>
- Specified by:
getBeanType
in interfaceBeanType<T>
- Returns:
- The produced bean type
-
getExposedTypes
@NonNull public 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 theType
annotation.- Specified by:
getExposedTypes
in interfaceBeanType<T>
- Returns:
- The exposed types
-
getDeclaringType
public final java.util.Optional<java.lang.Class<?>> getDeclaringType()
- Specified by:
getDeclaringType
in interfaceBeanDefinition<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 interfaceBeanDefinition<T>
- Returns:
- The constructor injection point
-
getRequiredComponents
public final java.util.Collection<java.lang.Class<?>> getRequiredComponents()
- Specified by:
getRequiredComponents
in interfaceBeanDefinition<T>
- Returns:
- All required components for this entity definition
-
getInjectedMethods
public final java.util.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 interfaceBeanDefinition<T>
- Returns:
- The required properties
-
getInjectedFields
public final java.util.List<FieldInjectionPoint<T,?>> getInjectedFields()
Description copied from interface:BeanDefinition
All the fields that require injection.- Specified by:
getInjectedFields
in interfaceBeanDefinition<T>
- Returns:
- The required fields
-
getPostConstructMethods
public final java.util.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 interfaceBeanDefinition<T>
- Returns:
- Methods to call post construct
-
getPreDestroyMethods
public final java.util.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 interfaceBeanDefinition<T>
- Returns:
- Methods to call pre-destroy
-
getName
@NonNull public final java.lang.String getName()
-
inject
public T inject(BeanContext context, T bean)
Description copied from interface:BeanDefinition
Inject the given bean with the context.- Specified by:
inject
in interfaceBeanDefinition<T>
- Parameters:
context
- The contextbean
- 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 interfaceBeanDefinition<T>
- Parameters:
resolutionContext
- the resolution contextcontext
- The contextbean
- The bean- Returns:
- The injected bean
-
getExecutableMethods
public final java.util.Collection<ExecutableMethod<T,?>> getExecutableMethods()
- Specified by:
getExecutableMethods
in interfaceBeanDefinition<T>
- Returns:
- The
ExecutableMethod
instances for this definition
-
configure
@Internal public final void configure(Environment environment)
Configures the bean for the givenBeanContext
. If the context features anEnvironment
this method configures the annotation metadata such that environment aware values are returned.- Specified by:
configure
in interfaceEnvironmentConfigurable
- 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 typemethod
- The methodproperty
- The property
-
getProxiedBean
@Internal protected final java.lang.Object getProxiedBean(BeanContext beanContext)
Resolves the proxied bean instance for this bean.- Parameters:
beanContext
- TheBeanContext
- Returns:
- The proxied bean
-
getRequiredArguments
public final io.micronaut.core.type.Argument<?>[] getRequiredArguments()
Implementing possibleParametrizedBeanFactory.getRequiredArguments()
.- Returns:
- The arguments required to construct parametrized bean
-
build
public final T build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues) throws BeanInstantiationException
Implementing possibleParametrizedBeanFactory.build(BeanResolutionContext, BeanContext, BeanDefinition)
.- Parameters:
resolutionContext
- TheBeanResolutionContext
context
- TheBeanContext
definition
- TheBeanDefinition
requiredArgumentValues
- The required arguments values. The keys should match the names of the arguments returned bygetRequiredArguments()
- Returns:
- The instantiated bean
- Throws:
BeanInstantiationException
- If the bean cannot be instantiated for the arguments supplied
-
doBuild
@Internal protected T doBuild(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues)
Method to be implemented by the generated code if the bean definition is implementingParametrizedBeanFactory
.- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextdefinition
- The bean definitionrequiredArgumentValues
- The required arguments- Returns:
- The built instance
-
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 contextcontext
- The bean contextbean
- 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 contextcontext
- The contextbean
- 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 hookcontext
- The contextbean
- The bean- Returns:
- The bean
-
preDestroy
@Internal 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 hookcontext
- The contextbean
- The bean- Returns:
- The bean
-
isInnerConfiguration
@Internal protected boolean isInnerConfiguration(java.lang.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 contextcontext
- - the bean context
-
checkInjectedBeanPropertyValue
@Internal protected final void checkInjectedBeanPropertyValue(java.lang.String injectedBeanPropertyName, @Nullable java.lang.Object beanPropertyValue, @Nullable java.lang.String requiredValue, @Nullable java.lang.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 propertybeanPropertyValue
- the value of injected bean propertyrequiredValue
- the value which is required for the bean to be loadednotEqualsValue
- 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, java.lang.Object bean, java.lang.Object[] methodArgs)
Invoke a bean method that requires reflection.- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexbean
- The beanmethodArgs
- The method args
-
setFieldWithReflection
@Internal protected final void setFieldWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int index, java.lang.Object object, java.lang.Object value)
Sets the value of a field of a object that requires reflection.- Parameters:
resolutionContext
- The resolution contextcontext
- The object contextindex
- The index of the fieldobject
- The object whose field should be modifievalue
- The instance being set
-
getValueForMethodArgument
@Internal @Deprecated protected final java.lang.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 contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexqualifier
- The qualifier- Returns:
- The value
-
getPropertyValueForMethodArgument
@Internal protected final java.lang.Object getPropertyValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, java.lang.String propertyValue, java.lang.String cliProperty)
Obtains a property value for the given method argument.- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexpropertyValue
- The property valuecliProperty
- The cli property- Returns:
- The value
-
getPropertyPlaceholderValueForMethodArgument
@Internal protected final java.lang.Object getPropertyPlaceholderValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, java.lang.String value)
Obtains a placeholder value for the given method argument.- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexvalue
- The property value- Returns:
- The value
-
getPropertyValueForSetter
@Internal protected final java.lang.Object getPropertyValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument<?> argument, java.lang.String propertyValue, java.lang.String cliProperty)
Obtains a property value for the given method argument.- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextsetterName
- The setter nameargument
- The argumentpropertyValue
- The property valuecliProperty
- The cli property- Returns:
- The value
-
getPropertyPlaceholderValueForSetter
@Internal protected final java.lang.Object getPropertyPlaceholderValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument<?> argument, java.lang.String value)
Obtains a placeholder value for the given method argument.- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextsetterName
- The setter nameargument
- The argumentvalue
- 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 contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexisValuePrefix
- 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 indexWarning: 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 contextcontext
- The contextmethodIndex
- The method indexargIndex
- The argument indexqualifier
- The qualifier- Returns:
- The resolved bean
-
getBeansOfTypeForMethodArgument
@Internal protected final <K,R extends java.util.Collection<K>> R getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argumentIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a method argument at the given index.- Type Parameters:
K
- The bean typeR
- The result collection type- Parameters:
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargumentIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanForSetter
@Internal protected final java.lang.Object getBeanForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument argument, Qualifier qualifier)
Obtains a bean definition for the method at the given index and the argument at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextsetterName
- The setter nameargument
- The argumentqualifier
- The qualifier- Returns:
- The resolved bean
-
getBeansOfTypeForSetter
@Internal protected final java.util.Collection<java.lang.Object> getBeansOfTypeForSetter(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String setterName, io.micronaut.core.type.Argument argument, io.micronaut.core.type.Argument genericType, Qualifier qualifier)
Obtains all bean definitions for a method argument at the given index.- Parameters:
resolutionContext
- The resolution contextcontext
- The contextsetterName
- The setter nameargument
- The argumentgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
findBeanForMethodArgument
@Internal protected final <K> java.util.Optional<K> findBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains an optional bean for the method at the given index and the argument at the given indexWarning: 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 contextcontext
- The contextmethodIndex
- The method indexargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getStreamOfTypeForMethodArgument
@Internal protected final java.util.stream.Stream<?> getStreamOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.Argument genericType, Qualifier qualifier)
Obtains all bean definitions for the method at the given index and the argument at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanForConstructorArgument
@Internal protected final java.lang.Object getBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
Obtains a bean definition for a constructor at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexqualifier
- The qualifier- Returns:
- The resolved bean
-
getValueForConstructorArgument
@Internal @Deprecated protected final java.lang.Object getValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
Deprecated.Obtains a value for a bean definition for a constructor at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexqualifier
- The qualifier- Returns:
- The resolved bean
-
getPropertyValueForConstructorArgument
@Internal protected final java.lang.Object getPropertyValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, java.lang.String propertyValue, java.lang.String cliProperty)
Obtains a property value for a bean definition for a constructor at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexpropertyValue
- The property valuecliProperty
- The cli property- Returns:
- The resolved bean
-
getPropertyPlaceholderValueForConstructorArgument
@Internal protected final java.lang.Object getPropertyPlaceholderValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, java.lang.String propertyValue)
Obtains a property value for a bean definition for a constructor at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexpropertyValue
- The property value- Returns:
- The resolved bean
-
getBeansOfTypeForConstructorArgument
@Internal protected final java.util.Collection<java.lang.Object> getBeansOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, io.micronaut.core.type.Argument genericType, Qualifier qualifier)
Obtains all bean definitions for a constructor argument at the given index.- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargumentIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanRegistrationsForConstructorArgument
@Internal protected final <K,R extends java.util.Collection<BeanRegistration<K>>> R getBeanRegistrationsForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a constructor argument at the given indexWarning: this method is used by internal generated code and should not be called by user code.
- Type Parameters:
K
- The bean typeR
- The result collection type- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargumentIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanRegistrationForConstructorArgument
@Internal protected final <K> BeanRegistration<K> getBeanRegistrationForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, io.micronaut.core.type.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 contextcontext
- The contextargumentIndex
- The arg indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean registration
-
getBeanRegistrationsForMethodArgument
@Internal protected final <K,R extends java.util.Collection<BeanRegistration<K>>> R getBeanRegistrationsForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.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 typeR
- The result collection type- Parameters:
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The arg indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanRegistrationForMethodArgument
@Internal protected final <K> BeanRegistration<K> getBeanRegistrationForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, io.micronaut.core.type.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 contextcontext
- The contextmethodIndex
- The method indexargIndex
- The arg indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean registration
-
getStreamOfTypeForConstructorArgument
@Internal protected final <K> java.util.stream.Stream<K> getStreamOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a constructor argument at the given indexWarning: 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 contextcontext
- The contextargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
findBeanForConstructorArgument
@Internal protected final <K> java.util.Optional<K> findBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for a constructor argument at the given indexWarning: 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 contextcontext
- The contextargIndex
- The argument indexgenericType
- The generic typequalifier
- 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 indexWarning: 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 contextcontext
- The contextfieldIndex
- The field indexqualifier
- 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 java.lang.Object getValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Qualifier qualifier)
Deprecated.Obtains a value for the given field from the bean contextWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The index of the fieldqualifier
- The qualifier- Returns:
- The resolved bean
-
getPropertyValueForField
@Internal @Deprecated protected final java.lang.Object getPropertyValueForField(BeanResolutionContext resolutionContext, BeanContext context, io.micronaut.core.type.Argument argument, java.lang.String propertyValue, java.lang.String cliProperty)
Deprecated.Obtains a property value for the given field from the bean contextWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargument
- The argumentpropertyValue
- The property valuecliProperty
- The clie property name- Returns:
- The resolved bean
-
getPropertyPlaceholderValueForField
@Internal @Deprecated protected final java.lang.Object getPropertyPlaceholderValueForField(BeanResolutionContext resolutionContext, BeanContext context, io.micronaut.core.type.Argument argument, java.lang.String placeholder)
Deprecated.Obtains a property placeholder value for the given field from the bean contextWarning: this method is used by internal generated code and should not be called by user code.
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargument
- The argumentplaceholder
- The placeholder- 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.- Type Parameters:
T1
- The generic type- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextpropertyType
- The required property typepropertyPath
- 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 contextcontext
- The bean contextfieldIndex
- The field indexisValuePrefix
- 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 aConfigurationProperties
bean return whether any properties for it are configured within the context.- Parameters:
resolutionContext
- the resolution contextcontext
- 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 aConfigurationProperties
bean return whether any properties for it are configured within the context.- Parameters:
resolutionContext
- the resolution contextcontext
- The contextsubProperty
- The subproperty to check- Returns:
- True if it does
-
getBeansOfTypeForField
@Internal protected final <K,R extends java.util.Collection<K>> java.lang.Object getBeansOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains all bean definitions for the field at the given index.- Type Parameters:
K
- The bean typeR
- The result collection type- Parameters:
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanRegistrationsForField
@Internal protected final <K,R extends java.util.Collection<BeanRegistration<K>>> R getBeanRegistrationsForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.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 typeR
- The result collection type- Parameters:
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getBeanRegistrationForField
@Internal protected final <K> BeanRegistration<K> getBeanRegistrationForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.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 contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean registration
-
findBeanForField
@Internal protected final <K> java.util.Optional<K> findBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a an optional for the field at the given index and the argument at the given indexWarning: 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 contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
getStreamOfTypeForField
@Internal protected final <K> java.util.stream.Stream<K> getStreamOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, io.micronaut.core.type.Argument<K> genericType, Qualifier<K> qualifier)
Obtains a bean definition for the field at the given index and the argument at the given indexWarning: 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 contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier- Returns:
- The resolved bean
-
containsPropertiesValue
@Internal protected final boolean containsPropertiesValue(BeanResolutionContext resolutionContext, BeanContext context, java.lang.String value)
-
containsPropertyValue
@Internal protected final boolean containsPropertyValue(BeanResolutionContext resolutionContext, BeanContext context, java.lang.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 interfaceBeanContextConditional
- Parameters:
context
- The contextresolutionContext
- The bean resolution context- Returns:
- True if it is
-
-