private static final ClassNode INVOKER_TYPE = make(InvokerHelper.class);
public void visit(ASTNode[] nodes, SourceUnit source) {
init(nodes, source);
AnnotatedNode parent = (AnnotatedNode) nodes[1];
AnnotationNode anno = (AnnotationNode) nodes[0];
if (!MY_TYPE.equals(anno.getClassNode())) return;
if (parent instanceof ClassNode) {
ClassNode cNode = (ClassNode) parent;
if (!checkNotInterface(cNode, MY_TYPE_NAME)) return;
boolean includeSuper = memberHasValue(anno, "includeSuper", true);
boolean cacheToString = memberHasValue(anno, "cache", true);
if (includeSuper && cNode.getSuperClass().getName().equals("java.lang.Object")) {
addError("Error during " + MY_TYPE_NAME + " processing: includeSuper=true but '" + cNode.getName() + "' has no super class.", anno);
}
boolean includeNames = memberHasValue(anno, "includeNames", true);
boolean includeFields = memberHasValue(anno, "includeFields", true);
List<String> excludes = getMemberList(anno, "excludes");
List<String> includes = getMemberList(anno, "includes");
boolean ignoreNulls = memberHasValue(anno, "ignoreNulls", true);
boolean includePackage = !memberHasValue(anno, "includePackage", false);
if (hasAnnotation(cNode, CanonicalASTTransformation.MY_TYPE)) {
AnnotationNode canonical = cNode.getAnnotations(CanonicalASTTransformation.MY_TYPE).get(0);
if (excludes == null || excludes.isEmpty()) excludes = getMemberList(canonical, "excludes");
if (includes == null || includes.isEmpty()) includes = getMemberList(canonical, "includes");
}
if (!checkIncludeExclude(anno, excludes, includes, MY_TYPE_NAME)) return;
createToString(cNode, includeSuper, includeFields, excludes, includes, includeNames, ignoreNulls, includePackage, cacheToString);