Interface ElementFactory<E,​C extends E,​M extends E,​F extends E>

  • Type Parameters:
    E - The type that represents the super type of all elements in the AST
    C - The type that represents a class in the AST
    M - The type that represents a method in the AST
    F - The type that represents a field in the AST

    public interface ElementFactory<E,​C extends E,​M extends E,​F extends E>
    A factory for creating elements.
    Since:
    2.3.0
    • Method Detail

      • newClassElement

        @NonNull
        ClassElement newClassElement​(@NonNull
                                     C type,
                                     @NonNull
                                     io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new class element for the given type.
        Parameters:
        type - The type
        annotationMetadata - The resolved annotation metadata
        Returns:
        The class element
      • newClassElement

        @NonNull
        ClassElement newClassElement​(@NonNull
                                     C type,
                                     @NonNull
                                     io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
                                     @NonNull
                                     java.util.Map<java.lang.String,​ClassElement> resolvedGenerics)
        Builds a new class element for the given type.
        Parameters:
        type - The type
        annotationMetadata - The resolved annotation metadata
        resolvedGenerics - The resolved generics
        Returns:
        The class element
        Since:
        3.0.0
      • newSourceClassElement

        @NonNull
        ClassElement newSourceClassElement​(@NonNull
                                           C type,
                                           @NonNull
                                           io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new source class element for the given type. This method differs from newClassElement(Object, AnnotationMetadata) in that it should only be called from elements that are known to originate from source code.
        Parameters:
        type - The type
        annotationMetadata - The resolved annotation metadata
        Returns:
        The class element
        Since:
        3.0.0
      • newSourceMethodElement

        @NonNull
        MethodElement newSourceMethodElement​(ClassElement declaringClass,
                                             @NonNull
                                             M method,
                                             @NonNull
                                             io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new source method element for the given method. This method differs from newMethodElement(ClassElement, Object, AnnotationMetadata) in that it should only be called from elements that are known to originate from source code.
        Parameters:
        declaringClass - The declaring class
        method - The method
        annotationMetadata - The resolved annotation metadata
        Returns:
        The class element
        Since:
        3.0.0
      • newMethodElement

        @NonNull
        MethodElement newMethodElement​(ClassElement declaringClass,
                                       @NonNull
                                       M method,
                                       @NonNull
                                       io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new method element for the given type.
        Parameters:
        declaringClass - The declaring class
        method - The method
        annotationMetadata - The resolved annotation metadata
        Returns:
        The method element
      • newConstructorElement

        @NonNull
        ConstructorElement newConstructorElement​(ClassElement declaringClass,
                                                 @NonNull
                                                 M constructor,
                                                 @NonNull
                                                 io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new constructor element for the given type.
        Parameters:
        declaringClass - The declaring class
        constructor - The constructor
        annotationMetadata - The resolved annotation metadata
        Returns:
        The constructor element
      • newEnumConstantElement

        @NonNull
        EnumConstantElement newEnumConstantElement​(ClassElement declaringClass,
                                                   @NonNull
                                                   F enumConstant,
                                                   @NonNull
                                                   io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new enum constant element for the given type.
        Parameters:
        declaringClass - The declaring class
        enumConstant - The enum constant
        annotationMetadata - The resolved annotation metadata
        Returns:
        The enum constant element
        Since:
        3.6.0
      • newFieldElement

        @NonNull
        FieldElement newFieldElement​(ClassElement declaringClass,
                                     @NonNull
                                     F field,
                                     @NonNull
                                     io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new field element for the given type.
        Parameters:
        declaringClass - The declaring class
        field - The field
        annotationMetadata - The resolved annotation metadata
        Returns:
        The field element
      • newFieldElement

        @NonNull
        FieldElement newFieldElement​(@NonNull
                                     F field,
                                     @NonNull
                                     io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
        Builds a new field element for the given field.
        Parameters:
        field - The field
        annotationMetadata - The resolved annotation metadata
        Returns:
        The field element