Package io.micronaut.inject
Interface DelegatingBeanDefinition<T>
-
- Type Parameters:
T
- The bean definition type
- All Superinterfaces:
io.micronaut.core.annotation.AnnotationMetadata
,io.micronaut.core.annotation.AnnotationMetadataDelegate
,io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.type.ArgumentCoercible<T>
,BeanContextConditional
,BeanDefinition<T>
,BeanType<T>
,io.micronaut.core.naming.Named
public interface DelegatingBeanDefinition<T> extends BeanDefinition<T>
An interface for wrapping aBeanDefinition
with another that delegates and potentially decorates theBeanDefinition
instance.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
-
Fields inherited from interface io.micronaut.inject.BeanDefinition
NAMED_ATTRIBUTE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <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.default <R> java.util.stream.Stream<ExecutableMethod<T,R>>
findPossibleMethods(java.lang.String name)
Finds possible methods for the given method name.default io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
default java.lang.Class<T>
getBeanType()
Returns the bean type.default ConstructorInjectionPoint<T>
getConstructor()
The single concrete constructor that is an injection point for creating the bean.default java.util.Optional<java.lang.Class<?>>
getDeclaringType()
default java.util.Collection<ExecutableMethod<T,?>>
getExecutableMethods()
default java.util.Collection<FieldInjectionPoint<T,?>>
getInjectedFields()
All the fields that require injection.default java.util.Collection<MethodInjectionPoint<T,?>>
getInjectedMethods()
All methods that require injection.default java.lang.String
getName()
default java.util.Collection<MethodInjectionPoint<T,?>>
getPostConstructMethods()
All the methods that should be called once the bean has been fully initialized and constructed.default java.util.Collection<MethodInjectionPoint<T,?>>
getPreDestroyMethods()
All the methods that should be called when the object is to be destroyed.default java.util.Collection<java.lang.Class<?>>
getRequiredComponents()
default <R> ExecutableMethod<T,R>
getRequiredMethod(java.lang.String name, java.lang.Class<?>... argumentTypes)
Finds a singleExecutableMethod
for the given name and argument types.default java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>>
getScope()
default java.util.Optional<java.lang.String>
getScopeName()
BeanDefinition<T>
getTarget()
default java.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.default T
inject(BeanContext context, T bean)
Inject the given bean with the context.default T
inject(BeanResolutionContext resolutionContext, BeanContext context, T bean)
Inject the given bean with the context.default boolean
isAbstract()
default boolean
isEnabled(BeanContext context)
Return whether this component is enabled for the given context.default boolean
isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.default boolean
isIterable()
default boolean
isPrimary()
default boolean
isProvided()
default boolean
isSingleton()
default boolean
requiresMethodProcessing()
By default, when theBeanContext
is started, theBeanDefinition.getExecutableMethods()
are not processed by registeredExecutableMethodProcessor
instances unless this method returns true.-
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, hasPropertyExpressions, 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.BeanDefinition
asArgument, getContainerElement, getDeclaredQualifier, getTypeArguments, getTypeArguments, getTypeParameters, getTypeParameters, isCandidateBean, isProxy, resolveDynamicQualifier
-
Methods inherited from interface io.micronaut.inject.BeanType
getExposedTypes, isContainerType
-
-
-
-
Method Detail
-
getTarget
BeanDefinition<T> getTarget()
- Returns:
- The target definition
-
requiresMethodProcessing
default 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()
-
getScope
default 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
default java.util.Optional<java.lang.String> getScopeName()
- Specified by:
getScopeName
in interfaceBeanDefinition<T>
- Returns:
- The name of the scope
-
getAnnotationMetadata
default io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadata
in interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
getRequiredMethod
default <R> ExecutableMethod<T,R> getRequiredMethod(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:
getRequiredMethod
in interfaceBeanDefinition<T>
- Type Parameters:
R
- The return type- Parameters:
name
- The method nameargumentTypes
- The argument types- Returns:
- An optional
ExecutableMethod
-
isAbstract
default boolean isAbstract()
- Specified by:
isAbstract
in interfaceBeanDefinition<T>
- Returns:
- Whether the bean definition is abstract
-
isSingleton
default boolean isSingleton()
- Specified by:
isSingleton
in interfaceBeanDefinition<T>
- Returns:
- Whether the scope is singleton
-
isProvided
default boolean isProvided()
- Specified by:
isProvided
in interfaceBeanDefinition<T>
- Returns:
- Is this definition provided by another bean
- See Also:
Provided
-
isIterable
default boolean isIterable()
- Specified by:
isIterable
in interfaceBeanDefinition<T>
- Returns:
- Whether the bean declared with
EachProperty
orEachBean
-
getBeanType
default 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
-
getConstructor
default 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
default java.util.Collection<java.lang.Class<?>> getRequiredComponents()
- Specified by:
getRequiredComponents
in interfaceBeanDefinition<T>
- Returns:
- All required components for this entity definition
-
getInjectedMethods
default java.util.Collection<MethodInjectionPoint<T,?>> getInjectedMethods()
Description copied from interface:BeanDefinition
All methods that require injection. This is a subset of all the methods in the class.- Specified by:
getInjectedMethods
in interfaceBeanDefinition<T>
- Returns:
- The required properties
-
getInjectedFields
default java.util.Collection<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
default java.util.Collection<MethodInjectionPoint<T,?>> getPostConstructMethods()
Description copied from interface:BeanDefinition
All the methods that should be called once the bean has been fully initialized and constructed.- Specified by:
getPostConstructMethods
in interfaceBeanDefinition<T>
- Returns:
- Methods to call post construct
-
getPreDestroyMethods
default java.util.Collection<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 default java.lang.String getName()
-
findMethod
default <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
default <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
-
inject
default 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
default 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
default java.util.Collection<ExecutableMethod<T,?>> getExecutableMethods()
- Specified by:
getExecutableMethods
in interfaceBeanDefinition<T>
- Returns:
- The
ExecutableMethod
instances for this definition
-
isPrimary
default boolean isPrimary()
-
isEnabled
default boolean isEnabled(BeanContext context)
Description copied from interface:BeanContextConditional
Return whether this component is enabled for the given context.- Specified by:
isEnabled
in interfaceBeanContextConditional
- Parameters:
context
- The context- Returns:
- True if it is
-
isEnabled
default 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
-
getDeclaringType
default java.util.Optional<java.lang.Class<?>> getDeclaringType()
- Specified by:
getDeclaringType
in interfaceBeanDefinition<T>
- Returns:
- The type that declares this definition, null if not applicable.
-
getTypeArguments
@NonNull default 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
-
-