Class ElementsImpl

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.ElementsImpl
All Implemented Interfaces:
Elements
Direct Known Subclasses:
ElementsImpl9

public class ElementsImpl extends Object implements Elements
Utilities for working with java8 and earlier language elements. There is one of these for every ProcessingEnvironment.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public static ElementsImpl create(BaseProcessingEnvImpl env)
    • getAllAnnotationMirrors

      public List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e)
      Return all the annotation mirrors on this element, including inherited annotations. Annotations are inherited only if the annotation type is meta-annotated with @Inherited, and the annotation is on a class: e.g., annotations are not inherited for interfaces, methods, or fields.
      Specified by:
      getAllAnnotationMirrors in interface Elements
    • getAllMembers

      public List<? extends Element> getAllMembers(TypeElement type)
      Compute a list of all the visible entities in this type. Specifically:
      • All nested types declared in this type, including interfaces and enums
      • All protected or public nested types declared in this type's superclasses and superinterfaces, that are not hidden by a name collision
      • All methods declared in this type, including constructors but not including static or instance initializers, and including abstract methods and unimplemented methods declared in interfaces
      • All protected or public methods declared in this type's superclasses, that are not overridden by another method, but not including constructors or initializers. Includes abstract methods and methods declared in superinterfaces but not implemented
      • All fields declared in this type, including constants
      • All non-private fields declared in this type's superclasses and superinterfaces, that are not hidden by a name collision.
      Specified by:
      getAllMembers in interface Elements
    • getBinaryName

      public Name getBinaryName(TypeElement type)
      Specified by:
      getBinaryName in interface Elements
    • getConstantExpression

      public String getConstantExpression(Object value)
      Specified by:
      getConstantExpression in interface Elements
    • getDocComment

      public String getDocComment(Element e)
      Specified by:
      getDocComment in interface Elements
    • getUnparsedDocComment

      protected char[] getUnparsedDocComment(Element e)
      Return the entire javadoc comment on e, including the comment characters and whitespace
      Parameters:
      e - an Element of any sort, possibly with a javadoc comment.
      Returns:
      a String, or null if the comment is not available
    • formatJavadoc

      protected static String formatJavadoc(char[] unparsed)
      Strip the comment characters from a javadoc comment. Assume the comment is already missing its closing delimiter. Javac's behavior with regard to tab expansion and trimming of whitespace and asterisks is bizarre and undocumented. We do our best here to emulate it.
    • getElementValuesWithDefaults

      public Map<? extends ExecutableElement,? extends AnnotationValue> getElementValuesWithDefaults(AnnotationMirror a)
      Specified by:
      getElementValuesWithDefaults in interface Elements
      Returns:
      all the annotation instance's explicitly set values, plus default values for all the annotation members that are not explicitly set but that have defaults. By comparison, AnnotationMirror.getElementValues() only returns the explicitly set values.
      See Also:
    • getName

      public Name getName(CharSequence cs)
      Specified by:
      getName in interface Elements
    • getPackageElement

      public PackageElement getPackageElement(CharSequence name)
      Specified by:
      getPackageElement in interface Elements
    • getPackageOf

      public PackageElement getPackageOf(Element type)
      Specified by:
      getPackageOf in interface Elements
    • getTypeElement

      public TypeElement getTypeElement(CharSequence name)
      Specified by:
      getTypeElement in interface Elements
    • hides

      public boolean hides(Element hider, Element hidden)
      Specified by:
      hides in interface Elements
    • isDeprecated

      public boolean isDeprecated(Element e)
      Specified by:
      isDeprecated in interface Elements
    • overrides

      public boolean overrides(ExecutableElement overrider, ExecutableElement overridden, TypeElement type)
      Specified by:
      overrides in interface Elements
    • printElements

      public void printElements(Writer w, Element... elements)
      Specified by:
      printElements in interface Elements
    • isFunctionalInterface

      public boolean isFunctionalInterface(TypeElement type)
      Specified by:
      isFunctionalInterface in interface Elements
    • isAutomaticModule

      public boolean isAutomaticModule(ModuleElement module)
      Specified by:
      isAutomaticModule in interface Elements