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 aBeanDefinitionwith another that delegates and potentially decorates theBeanDefinitioninstance.- 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 singleExecutableMethodfor 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.AnnotationMetadatagetAnnotationMetadata()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.StringgetName()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 singleExecutableMethodfor 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 Tinject(BeanContext context, T bean)Inject the given bean with the context.default Tinject(BeanResolutionContext resolutionContext, BeanContext context, T bean)Inject the given bean with the context.default booleanisAbstract()default booleanisEnabled(BeanContext context)Return whether this component is enabled for the given context.default booleanisEnabled(BeanContext context, BeanResolutionContext resolutionContext)Return whether this component is enabled for the given context.default booleanisIterable()default booleanisPrimary()default booleanisProvided()default booleanisSingleton()default booleanrequiresMethodProcessing()By default, when theBeanContextis started, theBeanDefinition.getExecutableMethods()are not processed by registeredExecutableMethodProcessorinstances 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:BeanTypeBy default, when theBeanContextis started, theBeanDefinition.getExecutableMethods()are not processed by registeredExecutableMethodProcessorinstances unless this method returns true.- Specified by:
requiresMethodProcessingin 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:
getScopein interfaceBeanDefinition<T>- Returns:
- The scope of the bean
-
getScopeName
default java.util.Optional<java.lang.String> getScopeName()
- Specified by:
getScopeNamein interfaceBeanDefinition<T>- Returns:
- The name of the scope
-
getAnnotationMetadata
default io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadatain interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
getRequiredMethod
default <R> ExecutableMethod<T,R> getRequiredMethod(java.lang.String name, java.lang.Class<?>... argumentTypes)
Description copied from interface:BeanDefinitionFinds a singleExecutableMethodfor the given name and argument types.- Specified by:
getRequiredMethodin 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:
isAbstractin interfaceBeanDefinition<T>- Returns:
- Whether the bean definition is abstract
-
isSingleton
default boolean isSingleton()
- Specified by:
isSingletonin interfaceBeanDefinition<T>- Returns:
- Whether the scope is singleton
-
isProvided
default boolean isProvided()
- Specified by:
isProvidedin interfaceBeanDefinition<T>- Returns:
- Is this definition provided by another bean
- See Also:
Provided
-
isIterable
default boolean isIterable()
- Specified by:
isIterablein interfaceBeanDefinition<T>- Returns:
- Whether the bean declared with
EachPropertyorEachBean
-
getBeanType
default java.lang.Class<T> getBeanType()
Description copied from interface:BeanTypeReturns the bean type.- Specified by:
getBeanTypein interfaceBeanDefinition<T>- Specified by:
getBeanTypein interfaceBeanType<T>- Returns:
- The produced bean type
-
getConstructor
default ConstructorInjectionPoint<T> getConstructor()
Description copied from interface:BeanDefinitionThe single concrete constructor that is an injection point for creating the bean.- Specified by:
getConstructorin interfaceBeanDefinition<T>- Returns:
- The constructor injection point
-
getRequiredComponents
default java.util.Collection<java.lang.Class<?>> getRequiredComponents()
- Specified by:
getRequiredComponentsin interfaceBeanDefinition<T>- Returns:
- All required components for this entity definition
-
getInjectedMethods
default java.util.Collection<MethodInjectionPoint<T,?>> getInjectedMethods()
Description copied from interface:BeanDefinitionAll methods that require injection. This is a subset of all the methods in the class.- Specified by:
getInjectedMethodsin interfaceBeanDefinition<T>- Returns:
- The required properties
-
getInjectedFields
default java.util.Collection<FieldInjectionPoint<T,?>> getInjectedFields()
Description copied from interface:BeanDefinitionAll the fields that require injection.- Specified by:
getInjectedFieldsin interfaceBeanDefinition<T>- Returns:
- The required fields
-
getPostConstructMethods
default java.util.Collection<MethodInjectionPoint<T,?>> getPostConstructMethods()
Description copied from interface:BeanDefinitionAll the methods that should be called once the bean has been fully initialized and constructed.- Specified by:
getPostConstructMethodsin interfaceBeanDefinition<T>- Returns:
- Methods to call post construct
-
getPreDestroyMethods
default java.util.Collection<MethodInjectionPoint<T,?>> getPreDestroyMethods()
Description copied from interface:BeanDefinitionAll the methods that should be called when the object is to be destroyed.- Specified by:
getPreDestroyMethodsin 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:BeanDefinitionFinds a singleExecutableMethodfor the given name and argument types.- Specified by:
findMethodin 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:BeanDefinitionFinds possible methods for the given method name.- Specified by:
findPossibleMethodsin 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:BeanDefinitionInject the given bean with the context.- Specified by:
injectin 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:BeanDefinitionInject the given bean with the context.- Specified by:
injectin 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:
getExecutableMethodsin interfaceBeanDefinition<T>- Returns:
- The
ExecutableMethodinstances for this definition
-
isPrimary
default boolean isPrimary()
-
isEnabled
default boolean isEnabled(BeanContext context)
Description copied from interface:BeanContextConditionalReturn whether this component is enabled for the given context.- Specified by:
isEnabledin interfaceBeanContextConditional- Parameters:
context- The context- Returns:
- True if it is
-
isEnabled
default boolean isEnabled(@NonNull BeanContext context, @Nullable BeanResolutionContext resolutionContext)Description copied from interface:BeanContextConditionalReturn whether this component is enabled for the given context.- Specified by:
isEnabledin 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:
getDeclaringTypein 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:BeanDefinitionReturn the type arguments for the given interface or super type for this bean.- Specified by:
getTypeArgumentsin interfaceBeanDefinition<T>- Parameters:
type- The super class or interface type- Returns:
- The type arguments
-
-