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
All Known Implementing Classes:
GroovyElementFactory, JavaElementFactory

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

    • newClassElement

      @NonNull ClassElement newClassElement(@NonNull C type, ElementAnnotationMetadataFactory annotationMetadataFactory)
      Builds a new class element for the given type.
      Parameters:
      type - The type
      annotationMetadataFactory - The element annotation metadata factory
      Returns:
      The class element
      Since:
      4.0.0
    • newClassElement

      @Deprecated default @NonNull ClassElement newClassElement(@NonNull C type, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @NonNull Map<String,ClassElement> typeArguments)
      Deprecated.
      no longer used
      Builds a new class element for the given type.
      Parameters:
      type - The type
      annotationMetadataFactory - The element annotation metadata factory
      typeArguments - The resolved generics
      Returns:
      The class element
      Since:
      4.0.0
    • newSourceClassElement

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

      @NonNull MethodElement newSourceMethodElement(@NonNull ClassElement owningClass, @NonNull M method, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory)
      Builds a new source method element for the given method. This method differs from newMethodElement(ClassElement, Object, ElementAnnotationMetadataFactory) in that it should only be called from elements that are known to originate from source code.
      Parameters:
      owningClass - The owning class
      method - The method
      elementAnnotationMetadataFactory - The element annotation metadata factory
      Returns:
      The class element
      Since:
      4.0.0
    • newMethodElement

      @NonNull MethodElement newMethodElement(@NonNull ClassElement owningClass, @NonNull M method, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory)
      Builds a new method element for the given type.
      Parameters:
      owningClass - The owning class
      method - The method
      elementAnnotationMetadataFactory - The element annotation metadata factory
      Returns:
      The method element
      Since:
      4.0.0
    • newConstructorElement

      @NonNull ConstructorElement newConstructorElement(@NonNull ClassElement owningClass, @NonNull M constructor, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory)
      Builds a new constructor element for the given type.
      Parameters:
      owningClass - The owning class
      constructor - The constructor
      elementAnnotationMetadataFactory - The element annotation metadata factory
      Returns:
      The constructor element
      Since:
      4.0.0
    • newEnumConstantElement

      @NonNull EnumConstantElement newEnumConstantElement(@NonNull ClassElement owningClass, @NonNull F enumConstant, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory)
      Builds a new enum constant element for the given type.
      Parameters:
      owningClass - The owning class
      enumConstant - The enum constant
      elementAnnotationMetadataFactory - The element annotation metadata factory
      Returns:
      The enum constant element
      Since:
      4.0.0
    • newFieldElement

      @NonNull FieldElement newFieldElement(@NonNull ClassElement owningClass, @NonNull F field, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory)
      Builds a new field element for the given type.
      Parameters:
      owningClass - The owning class
      field - The field
      elementAnnotationMetadataFactory - The element annotation metadata factory
      Returns:
      The field element
      Since:
      4.0.0