Interface BeanElement

  • All Superinterfaces:
    io.micronaut.core.annotation.AnnotatedElement, io.micronaut.core.annotation.AnnotationMetadata, io.micronaut.core.annotation.AnnotationMetadataDelegate, io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, io.micronaut.core.naming.Described, Element, io.micronaut.core.naming.Named
    All Known Implementing Classes:
    BeanDefinitionWriter

    public interface BeanElement
    extends Element
    Models a bean that will be produced by Micronaut.
    Since:
    3.0.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 BeanElementBuilder addAssociatedBean​(ClassElement type, VisitorContext visitorContext)
      This method adds an associated bean using this class element as the originating element.
      java.util.Set<ClassElement> getBeanTypes()
      The type names produced by the bean.
      ClassElement getDeclaringClass()
      Returns the declaring ClassElement which may differ from the getBeanTypes() in the case of factory beans.
      java.util.Collection<Element> getInjectionPoints()
      Returns all of the injection points for the bean.
      Element getOriginatingElement()  
      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.
      java.util.Collection<java.lang.String> getQualifiers()  
      java.util.Optional<java.lang.String> getScope()
      The scope of the bean.
      • Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement

        isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
      • 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.core.annotation.AnnotationMetadataProvider

        getAnnotationMetadata
    • Method Detail

      • getInjectionPoints

        @NonNull
        java.util.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
        java.util.Set<ClassElement> getBeanTypes()
        The type names produced by the bean.
        Returns:
        A set of types
      • getScope

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

        @NonNull
        java.util.Collection<java.lang.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