Search in sources :

Example 21 with ElementKind

use of javax.lang.model.element.ElementKind in project spring-framework by spring-projects.

the class StandardStereotypesProvider method getStereotypes.

@Override
public Set<String> getStereotypes(Element element) {
    Set<String> stereotypes = new LinkedHashSet<>();
    ElementKind kind = element.getKind();
    if (kind != ElementKind.CLASS && kind != ElementKind.INTERFACE) {
        return stereotypes;
    }
    for (AnnotationMirror annotation : this.typeHelper.getAllAnnotationMirrors(element)) {
        String type = this.typeHelper.getType(annotation);
        if (type.startsWith("javax.")) {
            stereotypes.add(type);
        }
    }
    return stereotypes;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ElementKind(javax.lang.model.element.ElementKind) AnnotationMirror(javax.lang.model.element.AnnotationMirror)

Aggregations

ElementKind (javax.lang.model.element.ElementKind)21 Element (javax.lang.model.element.Element)9 TypeElement (javax.lang.model.element.TypeElement)9 ExecutableElement (javax.lang.model.element.ExecutableElement)5 PackageElement (javax.lang.model.element.PackageElement)4 LinkedHashSet (java.util.LinkedHashSet)3 VariableElement (javax.lang.model.element.VariableElement)3 MetaModelGenerationException (org.hibernate.jpamodelgen.MetaModelGenerationException)3 HashSet (java.util.HashSet)2 AnnotationMirror (javax.lang.model.element.AnnotationMirror)2 Modifier (javax.lang.model.element.Modifier)2 TypeParameterElement (javax.lang.model.element.TypeParameterElement)2 TypeMirror (javax.lang.model.type.TypeMirror)2 TypeConverter (com.bluelinelabs.logansquare.typeconverters.TypeConverter)1 MoreElements.getAnnotationMirror (com.google.auto.common.MoreElements.getAnnotationMirror)1 Function (com.google.common.base.Function)1 TypeSpec (com.squareup.javapoet.TypeSpec)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1