本文整理了Java中org.codehaus.groovy.ast.AnnotationNode.isTargetAllowed()
方法的一些代码示例,展示了AnnotationNode.isTargetAllowed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotationNode.isTargetAllowed()
方法的具体详情如下:
包路径:org.codehaus.groovy.ast.AnnotationNode
类名称:AnnotationNode
方法名:isTargetAllowed
暂无
代码示例来源:origin: org.codehaus.groovy/groovy
@Override
public boolean isTargetAllowed(int target) {
lazyInit();
return super.isTargetAllowed(target);
}
代码示例来源:origin: org.codehaus.groovy/groovy
if (!isTargetAnnotation && !visited.isTargetAllowed(target)) {
addError("Annotation @" + name + " is not allowed on element "
+ AnnotationNode.targetToName(target), visited);
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
protected void visitAnnotations(AnnotatedNode node, int target) {
if(node.getAnnotations().isEmpty()) {
return;
}
this.currentClass.setAnnotated(true);
if(!isAnnotationCompatible()) {
addError("Annotations are not supported in the current runtime." + JVM_ERROR_MESSAGE,
node);
return;
}
Collection annotations = node.getAnnotations().values();
for(Iterator it = annotations.iterator(); it.hasNext(); ) {
AnnotationNode an = (AnnotationNode) it.next();
AnnotationNode annotation = visitAnnotation(an);
if(!annotation.isValid()) {
return;
}
if(!annotation.isTargetAllowed(target)) {
addError("Annotation @" + annotation.getClassNode().getName()
+ " is not allowed on element " + AnnotationNode.targetToName(target),
annotation);
}
}
}
代码示例来源:origin: org.kohsuke.droovy/groovy
protected void visitAnnotations(AnnotatedNode node, int target) {
if (node.getAnnotations().isEmpty()) {
return;
}
this.currentClass.setAnnotated(true);
if (!isAnnotationCompatible()) {
addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node);
return;
}
Collection annotations = node.getAnnotations();
for (Iterator it = annotations.iterator(); it.hasNext();) {
AnnotationNode annotation = visitAnnotation((AnnotationNode) it.next());
boolean isTargetAnnotation = annotation.getClassNode().isResolved() &&
annotation.getClassNode().getTypeClass() == Target.class;
// Check if the annotation target is correct, unless it's the target annotating an annotation definition
// defining on which target elements the annotation applies
if (!isTargetAnnotation && !annotation.isTargetAllowed(target)) {
addError("Annotation @" + annotation.getClassNode().getName()
+ " is not allowed on element " + AnnotationNode.targetToName(target),
annotation);
}
}
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
protected void visitAnnotations(AnnotatedNode node, int target) {
if (node.getAnnotations().isEmpty()) {
return;
}
this.currentClass.setAnnotated(true);
if (!isAnnotationCompatible()) {
addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node);
return;
}
Collection annotations = node.getAnnotations();
for (Iterator it = annotations.iterator(); it.hasNext();) {
AnnotationNode annotation = visitAnnotation((AnnotationNode) it.next());
boolean isTargetAnnotation = annotation.getClassNode().isResolved() &&
annotation.getClassNode().getTypeClass() == Target.class;
// Check if the annotation target is correct, unless it's the target annotating an annotation definition
// defining on which target elements the annotation applies
if (!isTargetAnnotation && !annotation.isTargetAllowed(target)) {
addError("Annotation @" + annotation.getClassNode().getName()
+ " is not allowed on element " + AnnotationNode.targetToName(target),
annotation);
}
visitDeprecation(node, annotation);
}
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
protected void visitAnnotations(AnnotatedNode node, int target) {
if (node.getAnnotations().isEmpty()) {
return;
}
this.currentClass.setAnnotated(true);
if (!isAnnotationCompatible()) {
addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node);
return;
}
for (AnnotationNode unvisited : node.getAnnotations()) {
AnnotationNode visited = visitAnnotation(unvisited);
boolean isTargetAnnotation = visited.getClassNode().isResolved() &&
visited.getClassNode().getName().equals("java.lang.annotation.Target");
// Check if the annotation target is correct, unless it's the target annotating an annotation definition
// defining on which target elements the annotation applies
if (!isTargetAnnotation && !visited.isTargetAllowed(target)) {
addError("Annotation @" + visited.getClassNode().getName()
+ " is not allowed on element " + AnnotationNode.targetToName(target),
visited);
}
visitDeprecation(node, visited);
}
}
内容来源于网络,如有侵权,请联系作者删除!