All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.avaje.inject.generator.AnnotationUtil-e Maven / Gradle / Ivy

package io.avaje.inject.generator;

import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;

final class AnnotationUtil {

  static boolean hasAnnotationWithName(Element element, String matchShortName) {
    for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
      if (matchShortName.equals(shortName(mirror.getAnnotationType().asElement()))) {
        return true;
      }
    }
    return false;
  }

  /**
   * Return the short name of the element.
   */
  private static String shortName(Element element) {
    return element.getSimpleName().toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy