Class AbstractBeanResolutionContext

    • Constructor Detail

      • AbstractBeanResolutionContext

        @Internal
        protected AbstractBeanResolutionContext​(DefaultBeanContext context,
                                                BeanDefinition<?> rootDefinition)
        Parameters:
        context - The bean context
        rootDefinition - The bean root definition
    • Method Detail

      • getBean

        @NonNull
        public <T> T getBean​(@NonNull
                             io.micronaut.core.type.Argument<T> beanType,
                             @Nullable
                             Qualifier<T> qualifier)
        Description copied from interface: BeanResolutionContext
        Get a bean of the given type and qualifier.
        Specified by:
        getBean in interface BeanResolutionContext
        Type Parameters:
        T - The bean type parameter
        Parameters:
        beanType - The bean type
        qualifier - The qualifier
        Returns:
        The found bean
      • getBeansOfType

        @NonNull
        public <T> java.util.Collection<T> getBeansOfType​(@NonNull
                                                          io.micronaut.core.type.Argument<T> beanType,
                                                          @Nullable
                                                          Qualifier<T> qualifier)
        Description copied from interface: BeanResolutionContext
        Get all beans of the given type and qualifier.
        Specified by:
        getBeansOfType in interface BeanResolutionContext
        Type Parameters:
        T - The bean type parameter
        Parameters:
        beanType - The bean type
        qualifier - The qualifier
        Returns:
        The found beans
      • streamOfType

        @NonNull
        public <T> java.util.stream.Stream<T> streamOfType​(@NonNull
                                                           io.micronaut.core.type.Argument<T> beanType,
                                                           @Nullable
                                                           Qualifier<T> qualifier)
        Description copied from interface: BeanResolutionContext
        Obtains a stream of beans of the given type and qualifier.
        Specified by:
        streamOfType in interface BeanResolutionContext
        Type Parameters:
        T - The bean concrete type
        Parameters:
        beanType - The bean type
        qualifier - The qualifier
        Returns:
        A stream
      • findBean

        @NonNull
        public <T> java.util.Optional<T> findBean​(@NonNull
                                                  io.micronaut.core.type.Argument<T> beanType,
                                                  @Nullable
                                                  Qualifier<T> qualifier)
        Description copied from interface: BeanResolutionContext
        Find an optional bean of the given type and qualifier.
        Specified by:
        findBean in interface BeanResolutionContext
        Type Parameters:
        T - The bean type parameter
        Parameters:
        beanType - The bean type
        qualifier - The qualifier
        Returns:
        The found bean wrapped as an Optional
      • inject

        @NonNull
        public <T> T inject​(@Nullable
                            BeanDefinition<?> beanDefinition,
                            @NonNull
                            T instance)
        Description copied from interface: BeanResolutionContext
        Injects a bean.
        Specified by:
        inject in interface BeanResolutionContext
        Type Parameters:
        T - The instance type
        Parameters:
        beanDefinition - The requesting bean definition
        instance - The instance
        Returns:
        The instance
      • getBeanRegistrations

        @NonNull
        public <T> java.util.Collection<BeanRegistration<T>> getBeanRegistrations​(@NonNull
                                                                                  io.micronaut.core.type.Argument<T> beanType,
                                                                                  @Nullable
                                                                                  Qualifier<T> qualifier)
        Description copied from interface: BeanResolutionContext
        Obtains the bean registrations for the given type and qualifier.
        Specified by:
        getBeanRegistrations in interface BeanResolutionContext
        Type Parameters:
        T - The generic type
        Parameters:
        beanType - The bean type
        qualifier - The qualifier
        Returns:
        A collection of BeanRegistration
      • copyStateFrom

        public void copyStateFrom​(@NonNull
                                  AbstractBeanResolutionContext context)
        Copy the state from a previous resolution context.
        Parameters:
        context - The previous context
      • pushDependentBeans

        public void pushDependentBeans​(java.util.List<BeanRegistration<?>> dependentBeans)
        Description copied from interface: BeanResolutionContext
        The push the current dependent beans that must be destroyed by an upstream bean.
        Specified by:
        pushDependentBeans in interface BeanResolutionContext
        Parameters:
        dependentBeans - Dependent beans collection that can be used to add more dependents
      • setAttribute

        public final java.lang.Object setAttribute​(java.lang.CharSequence key,
                                                   java.lang.Object value)
        Description copied from interface: BeanResolutionContext
        Store a value within the context.
        Specified by:
        setAttribute in interface BeanResolutionContext
        Parameters:
        key - The key
        value - The value
        Returns:
        The previous value or null
      • getAttribute

        public final java.lang.Object getAttribute​(java.lang.CharSequence key)
        Specified by:
        getAttribute in interface BeanResolutionContext
        Parameters:
        key - The key
        Returns:
        The attribute value
      • removeAttribute

        public final java.lang.Object removeAttribute​(java.lang.CharSequence key)
        Description copied from interface: BeanResolutionContext
        Remove the attribute for the given key.
        Specified by:
        removeAttribute in interface BeanResolutionContext
        Parameters:
        key - the key
        Returns:
        The previous value
      • get

        public <T> java.util.Optional<T> get​(java.lang.CharSequence name,
                                             io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext)
        Specified by:
        get in interface io.micronaut.core.value.ValueResolver<java.lang.CharSequence>
      • get

        public <T> java.util.Optional<T> get​(java.lang.CharSequence name,
                                             java.lang.Class<T> requiredType)
        Specified by:
        get in interface io.micronaut.core.value.ValueResolver<java.lang.CharSequence>