Class BasicAnnotationProcessor.ElementName

  • Enclosing class:
    BasicAnnotationProcessor

    private static final class BasicAnnotationProcessor.ElementName
    extends java.lang.Object
    A package or type name.

    It's unfortunate that we have to track types and packages separately, but since there are two different methods to look them up in Elements, we end up with a lot of parallel logic. :(

    Packages declared (and annotated) in package-info.java are tracked as deferred packages, type elements are tracked directly, and all other elements are tracked via their nearest enclosing type.

    • Method Detail

      • forAnnotatedElement

        static BasicAnnotationProcessor.ElementName forAnnotatedElement​(javax.lang.model.element.Element element)
        An BasicAnnotationProcessor.ElementName for an annotated element. If element is a package, uses the fully qualified name of the package. If it's a type, uses its fully qualified name. Otherwise, uses the fully-qualified name of the nearest enclosing type.
      • name

        java.lang.String name()
        The fully-qualified name of the element.
      • getElement

        com.google.common.base.Optional<? extends javax.lang.model.element.Element> getElement​(javax.lang.model.util.Elements elements)
        The Element whose fully-qualified name is name(). Absent if the relevant method on Elements returns null.
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object