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 a BeanDefinition with another that delegates and potentially decorates the BeanDefinition 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.core.annotation.AnnotationSource

        EMPTY
    • 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 single ExecutableMethod 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 single ExecutableMethod 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 the BeanContext is started, the BeanDefinition.getExecutableMethods() are not processed by registered ExecutableMethodProcessor 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
    • Method Detail

      • getScope

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

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

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

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

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

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

        default java.util.Collection<java.lang.Class<?>> getRequiredComponents()
        Specified by:
        getRequiredComponents in interface BeanDefinition<T>
        Returns:
        All required components for this entity definition
      • 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 interface BeanDefinition<T>
        Returns:
        Methods to call post construct
      • getName

        @NonNull
        default java.lang.String getName()
        Specified by:
        getName in interface BeanDefinition<T>
        Specified by:
        getName in interface BeanType<T>
        Specified by:
        getName in interface io.micronaut.core.naming.Named
        Returns:
        The class name
      • 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 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

        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 interface BeanDefinition<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 interface BeanDefinition<T>
        Parameters:
        context - The context
        bean - 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 interface BeanDefinition<T>
        Parameters:
        resolutionContext - the resolution context
        context - The context
        bean - The bean
        Returns:
        The injected bean
      • isPrimary

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

        default java.util.Optional<java.lang.Class<?>> getDeclaringType()
        Specified by:
        getDeclaringType in interface BeanDefinition<T>
        Returns:
        The type that declares this definition, null if not applicable.
      • 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 interface BeanDefinition<T>
        Parameters:
        type - The super class or interface type
        Returns:
        The type arguments