Java Code Examples for javax.lang.model.element.ElementKind.equals()

The following are Jave code examples for showing how to use equals() of the javax.lang.model.element.ElementKind class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Java-9-Programming-By-Example   File: Aptools.java   Source Code and License Vote up 5 votes
private String getKindName(ElementKind kind) {
  Element element = this.element;
  while (element != null && element.getKind() != kind) {
    element = element.getEnclosingElement();
  }
  if (kind.equals(ElementKind.PACKAGE)) {
    return ((PackageElement) element).getQualifiedName().toString();
  } else {
    return element.getSimpleName().toString();
  }
}
 
Example 2
Project: Java-SE-9-Road-to-Concurrent-and-High-Performance-Programming   File: Aptools.java   Source Code and License Vote up 5 votes
private String getKindName(ElementKind kind) {
  Element element = this.element;
  while (element != null && element.getKind() != kind) {
    element = element.getEnclosingElement();
  }
  if (kind.equals(ElementKind.PACKAGE)) {
    return ((PackageElement) element).getQualifiedName().toString();
  } else {
    return element.getSimpleName().toString();
  }
}
 
Example 3
Project: annotation-processor-toolkit   File: ElementUtils.java   Source Code and License Vote up 2 votes
/**
 * Checks if passed Element instance is of a specific kind.
 *
 * @param e    the element to check
 * @param kind the kind to check for
 * @return true if passed element is of the passed kind, otherwise false
 */
public static boolean isOfKind(Element e, ElementKind kind) {
    return kind != null && e != null ? kind.equals(e.getKind()) : false;
}