List of usage examples for javax.lang.model.element Name contentEquals
boolean contentEquals(CharSequence cs);
From source file:ch.rasc.constgen.CodeGenerator.java
private boolean isTransient(VariableElement el) { for (AnnotationMirror am : this.elements.getAllAnnotationMirrors(el)) { Name qualifiedName = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName(); if (qualifiedName.contentEquals("org.springframework.data.annotation.Transient") || qualifiedName.contentEquals("org.mongodb.morphia.annotations.Transient") || qualifiedName.contentEquals("ch.rasc.bsoncodec.annotation.Transient")) { return true; }//from w w w . jav a 2 s .c om } return false; }
From source file:ch.rasc.constgen.CodeGenerator.java
private String getValue(VariableElement el) { String alternateValue = null; for (AnnotationMirror am : this.elements.getAllAnnotationMirrors(el)) { Name qualifiedName = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName(); if (qualifiedName.contentEquals("org.springframework.data.mongodb.core.mapping.Field") || qualifiedName.contentEquals("org.mongodb.morphia.annotations.Property") || qualifiedName.contentEquals("ch.rasc.bsoncodec.annotation.Field")) { alternateValue = am.getElementValues().entrySet().stream() .filter(e -> e.getKey().getSimpleName().toString().equals("value")) .map(e -> (String) e.getValue().getValue()) .filter(s -> !".".equals(s) && !"".equals(s.trim())).findAny().orElse(null); } else if (qualifiedName.contentEquals("ch.rasc.bsoncodec.annotation.Id")) { alternateValue = "_id"; }// w w w. j a va 2 s . c om } if (alternateValue == null) { String simpleName = el.getSimpleName().toString(); if (bsoncodecProject) { if ("id".equals(simpleName)) { return "_id"; } } return simpleName; } return alternateValue; }
From source file:io.github.jeddict.jcode.util.JavaSourceHelper.java
public static boolean isInjectionTarget(CompilationController controller, TypeElement typeElement) { if (ElementKind.INTERFACE != typeElement.getKind()) { List<? extends AnnotationMirror> annotations = typeElement.getAnnotationMirrors(); boolean found = false; for (AnnotationMirror m : annotations) { Name qualifiedName = ((TypeElement) m.getAnnotationType().asElement()).getQualifiedName(); if (qualifiedName.contentEquals("javax.jws.WebService")) { //NOI18N found = true;//from w w w.j a v a 2 s . c o m break; } if (qualifiedName.contentEquals("javax.jws.WebServiceProvider")) { //NOI18N found = true; break; } } if (found) { return true; } } return false; }