Interface BeanElement

All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Element, MutableAnnotationMetadataDelegate<Element>, Named
All Known Implementing Classes:
BeanDefinitionWriter

public interface BeanElement extends Element
Models a bean that will be produced by Micronaut.
Since:
3.0.0
Author:
graemerocher
  • Method Details

    • getInjectionPoints

      @NonNull Collection<Element> getInjectionPoints()
      Returns all of the injection points for the bean. These will be a combination of FieldElement and MethodElement instances.
      Returns:
      The injection points for the bean.
    • getOriginatingElement

      @NonNull Element getOriginatingElement()
      Returns:
      The originating element.
    • getDeclaringClass

      @NonNull ClassElement getDeclaringClass()
      Returns the declaring ClassElement which may differ from the getBeanTypes() in the case of factory beans.
      Returns:
      The declaring class of the bean.
    • getProducingElement

      @NonNull Element getProducingElement()
      The element that produces the bean, this could be a ClassElement for regular beans, or either a MethodElement or FieldElement for factory beans.
      Returns:
      The producing element
    • getBeanTypes

      @NonNull Set<ClassElement> getBeanTypes()
      The type names produced by the bean.
      Returns:
      A set of types
    • getScope

      @NonNull Optional<String> getScope()
      The scope of the bean.
      Returns:
      The fully qualified name of the scope or empty if no scope is defined.
    • getQualifiers

      @NonNull Collection<String> getQualifiers()
      Returns:
      One or more fully qualified qualifier types defined by the bean.
    • addAssociatedBean

      @NonNull default BeanElementBuilder addAssociatedBean(@NonNull ClassElement type, @NonNull VisitorContext visitorContext)
      This method adds an associated bean using this class element as the originating element.

      Note that this method can only be called on classes being directly compiled by Micronaut. If the ClassElement is loaded from pre-compiled code an UnsupportedOperationException will be thrown.

      Parameters:
      type - The type of the bean
      visitorContext - The visitor context
      Returns:
      A bean builder