public void removeChromatticAnnotation(FieldNode fieldNode) { Iterator<AnnotationNode> it = fieldNode.getAnnotations().iterator(); while(it.hasNext()) if (it.next().getClassNode().getName().startsWith(GroovyUtils.ANNOTATIONS_PACKAGE)) it.remove(); }
public static boolean isChromatticAnnoted(FieldNode fieldNode) { for (AnnotationNode annotationNode : (List<AnnotationNode>) fieldNode.getAnnotations()) { if (annotationNode.getClassNode().getName().startsWith(GroovyUtils.ANNOTATIONS_PACKAGE)) return true; } return false; }
@Nonnull public static FieldExpression injectedField(@Nonnull ClassNode owner, @Nonnull ClassNode type, @Nonnull String name, @Nullable String qualifierName) { FieldNode fieldNode = GriffonASTUtils.injectField(owner, name, Modifier.PRIVATE, type, null, false); if (fieldNode.getAnnotations(INJECT_TYPE) == null) { fieldNode.addAnnotation(new AnnotationNode(INJECT_TYPE)); } if (isNotBlank(qualifierName) && fieldNode.getAnnotations(NAMED_TYPE) == null) { AnnotationNode namedAnnotation = new AnnotationNode(NAMED_TYPE); namedAnnotation.addMember("value", new ConstantExpression(qualifierName)); fieldNode.addAnnotation(namedAnnotation); } return new FieldExpression(fieldNode); } }
private void addFieldOccurrences(FieldNode visitedField, ClassNode findingNode) { addOccurrences(visitedField.getType(), findingNode); // Check all field level annotations for (AnnotationNode annotation : visitedField.getAnnotations(findingNode)) { addAnnotationOccurrences(annotation, findingNode); } }
public static FieldExpression injectedField(@Nonnull ClassNode owner, @Nonnull ClassNode type, @Nonnull String name, @Nullable String qualifierName) { FieldNode fieldNode = GriffonASTUtils.injectField(owner, name, Modifier.PRIVATE, type, null, false); List<AnnotationNode> annotations = fieldNode.getAnnotations(INJECT_TYPE); if (annotations == null || annotations.isEmpty()) { fieldNode.addAnnotation(new AnnotationNode(INJECT_TYPE)); } if (isNotBlank(qualifierName)) { AnnotationNode namedAnnotation = new AnnotationNode(NAMED_TYPE); namedAnnotation.addMember("value", new ConstantExpression(qualifierName)); fieldNode.addAnnotation(namedAnnotation); } return new FieldExpression(fieldNode); }
private boolean isInChromatticHierarchy(ClassNode classNode) { if (classNode != null) { Set<AnnotationNode> annotationNodeSet = new HashSet<AnnotationNode>(); annotationNodeSet.addAll(classNode.getAnnotations()); for (FieldNode fieldNode : classNode.getFields()) annotationNodeSet.addAll(fieldNode.getAnnotations()); for (MethodNode methodNode : classNode.getMethods()) annotationNodeSet.addAll(methodNode.getAnnotations()); for (AnnotationNode annotationNode : annotationNodeSet) { if (annotationNode.getClassNode().getName().startsWith(GroovyUtils.ANNOTATIONS_PACKAGE)) { return true; } } return isInChromatticHierarchy(classNode.getSuperClass()); } else { return false; } } }
for (AnnotationNode fieldAnnotation : field.getAnnotations()) { final String fieldAnnotationName = fieldAnnotation.getClassNode().getNameWithoutPackage();
for (AnnotationNode fieldAnnotation : field.getAnnotations()) { final String fieldAnnotationName = fieldAnnotation.getClassNode().getNameWithoutPackage();
} catch (IllegalStateException iae) { FieldNode fieldNode = injectField(classNode, PROPERTY_APPLICATION, PRIVATE, GRIFFON_APPLICATION_TYPE, null, false); List<AnnotationNode> annotations = fieldNode.getAnnotations(INJECT_TYPE); if (annotations == null || annotations.isEmpty()) { fieldNode.addAnnotation(new AnnotationNode(INJECT_TYPE));
for (AnnotationNode annotation : originalProp.getField().getAnnotations()) { if (FXOBSERVABLE_CNODE.equals(annotation.getClassNode())) { continue; } Class annotationClass = annotation.getClassNode().getTypeClass();
annotationMover.generateSetter(classNode, fieldNode); for (AnnotationNode annotationNode : (List<AnnotationNode>) fieldNode.getAnnotations()) { if (annotationNode.getClassNode().getName().startsWith(GroovyUtils.ANNOTATIONS_PACKAGE)) { fieldChecker.checkChromaticFieldType(fieldNode);
FieldNode field = (FieldNode) leaf; for (AnnotationNode annotation : field.getAnnotations()) { if (isCaretOnAnnotation(annotation, doc, caret)) { return annotation.getClassNode(); FieldNode field = property.getField(); for (AnnotationNode annotation : field.getAnnotations()) { if (isCaretOnAnnotation(annotation, doc, caret)) { return annotation.getClassNode();