当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationDeclaration类代码示例

本文整理汇总了Java中com.github.javaparser.ast.body.AnnotationDeclaration的典型用法代码示例。如果您正苦于以下问题:Java AnnotationDeclaration类的具体用法?Java AnnotationDeclaration怎么用?Java AnnotationDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnnotationDeclaration类属于com.github.javaparser.ast.body包,在下文中一共展示了AnnotationDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
public void visit(final AnnotationDeclaration n, final Object arg) {
    printer.printLn("AnnotationDeclaration");
    printJavaComment(n.getComment(), arg);
    printJavadoc(n.getJavaDoc(), arg);
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());

    printer.print("@interface ");
    printer.print(n.getName());
    printer.printLn(" {");
    printer.indent();
    if (n.getMembers() != null) {
        printMembers(n.getMembers(), arg);
    }
    printer.unindent();
    printer.print("}");
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:19,代码来源:ASTDumpVisitor.java

示例2: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
  public JCTree visit(final AnnotationDeclaration n, final Object arg) {
       /* TODO - Annotations are not currently supported
   if (n.getJavaDoc() != null) {
      JCTree result = n.getJavaDoc().accept(this, arg);
}
if (n.getAnnotations() != null) {
   for (final AnnotationExpr a : n.getAnnotations()) {
  JCTree result = a.accept(this, arg);
   }
}
if (n.getMembers() != null) {
   for (final BodyDeclaration member : n.getMembers()) {
  JCTree result = member.accept(this, arg);
   }
}

return new AJCAnnotationDeclaration( make.AnnotationDeclaration( ), ( (n.getComment()!=null)?n.getComment().getContent():null ) );
       */
      System.err.println("Assigning null at:" + Thread.currentThread().getStackTrace()[1].getLineNumber());
      return null;
  }
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:23,代码来源:JavaParser2JCTree.java

示例3: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public Boolean visit(final AnnotationDeclaration n1, final Node arg) {
	final AnnotationDeclaration n2 = (AnnotationDeclaration) arg;

	// javadoc are checked at CompilationUnit

	if (n1.getModifiers() != n2.getModifiers()) {
		return Boolean.FALSE;
	}

	if (!objEquals(n1.getName(), n2.getName())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
		return Boolean.FALSE;
	}

	return Boolean.TRUE;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:24,代码来源:EqualsVisitor.java

示例4: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public void visit(final AnnotationDeclaration n, final Object arg) {
printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());

printer.print("@interface ");
printer.print(n.getName());
printer.printLn(" {");
printer.indent();
if (n.getMembers() != null) {
    printMembers(n.getMembers(), arg);
}
printer.unindent();
printer.print("}");
   }
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:17,代码来源:DumpVisitor.java

示例5: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public void visit(final AnnotationDeclaration n, final A arg) {
	visitComment(n.getComment(), arg);
	if (n.getJavaDoc() != null) {
		n.getJavaDoc().accept(this, arg);
	}
	if (n.getAnnotations() != null) {
		for (final AnnotationExpr a : n.getAnnotations()) {
			a.accept(this, arg);
		}
	}
	if (n.getMembers() != null) {
		for (final BodyDeclaration member : n.getMembers()) {
			member.accept(this, arg);
		}
	}
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:17,代码来源:VoidVisitorAdapter.java

示例6: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public void visit(final AnnotationDeclaration n, final A arg) {
    jw.write(n); 
    visitComment(n.getComment(), arg);
    if (n.getJavaDoc() != null) {
        n.getJavaDoc().accept(this, arg);
    }
    if (n.getAnnotations() != null) {
        for (final AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    if (n.getMembers() != null) {
        for (final BodyDeclaration member : n.getMembers()) {
            member.accept(this, arg);
        }
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:18,代码来源:JsonVisitorAdapter.java

示例7: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public Node visit(final AnnotationDeclaration n, final A arg) {
	if (n.getJavaDoc() != null) {
		n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg));
	}
	final List<AnnotationExpr> annotations = n.getAnnotations();
	if (annotations != null) {
		for (int i = 0; i < annotations.size(); i++) {
			annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
		}
		removeNulls(annotations);
	}
	final List<BodyDeclaration> members = n.getMembers();
	if (members != null) {
		for (int i = 0; i < members.size(); i++) {
			members.set(i, (BodyDeclaration) members.get(i).accept(this, arg));
		}
		removeNulls(members);
	}
	return n;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:21,代码来源:ModifierVisitorAdapter.java

示例8: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public Boolean visit(final AnnotationDeclaration n1, final Node arg) {
	final AnnotationDeclaration n2 = (AnnotationDeclaration) arg;

	// javadoc are checked at CompilationUnit

       if (!n1.getModifiers().equals(n2.getModifiers())) {
		return false;
	}

	if (!objEquals(n1.getName(), n2.getName())) {
		return false;
	}

	if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
		return false;
	}

	if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
		return false;
	}

	return true;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:24,代码来源:EqualsVisitor.java

示例9: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override public void visit(final AnnotationDeclaration n, final Object arg) {
	printJavaComment(n.getComment(), arg);
	printJavadoc(n.getJavaDoc(), arg);
	printMemberAnnotations(n.getAnnotations(), arg);
	printModifiers(n.getModifiers());

	printer.print("@interface ");
	printer.print(n.getName());
	printer.printLn(" {");
	printer.indent();
	if (n.getMembers() != null) {
		printMembers(n.getMembers(), arg);
	}
	printer.unindent();
	printer.print("}");
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:17,代码来源:DumpVisitor.java

示例10: calculateRelations

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
public void calculateRelations(Collection<File> files) {
    System.out.println();
    int totalFiles = files.size();
    int fileIndex = 1;
    for (File file : files) {
        try {
            CompilationUnit cu = parse(file);
            NodeList<TypeDeclaration<?>> types = cu.getTypes();
            for (TypeDeclaration<?> type : types) {
                boolean isInterface = type instanceof ClassOrInterfaceDeclaration && ((ClassOrInterfaceDeclaration) type).isInterface();
                boolean isAnnotation = type instanceof AnnotationDeclaration;
                boolean isEnumeration = type instanceof EnumDeclaration;
                boolean isClass = !isAnnotation && !isEnumeration && !isInterface;
                if (isInterface) {
                    // check if this interface extends another interface and persist relation in EXTENDS table
                    ClassOrInterfaceDeclaration interfaceDeclaration = (ClassOrInterfaceDeclaration) type;
                    extendsRelationCalculator.calculate(interfaceDeclaration, cu);
                }
                if (isClass) {
                    ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) type;
                    // check if this class implements an interface and persist relation in IMPLEMENTS table
                    implementsRelationCalculator.calculate(classDeclaration, cu);
                    // check if this class extends another class and persist relation in EXTENDS table
                    extendsRelationCalculator.calculate(classDeclaration, cu);
                }
                if (isClass || isInterface) {
                    annotatedWithCalculator.calculate((ClassOrInterfaceDeclaration) type, cu);
                }
            }
        } catch (ParseProblemException | IOException e) {
            System.err.println("Error while parsing " + file.getAbsolutePath());
        }
        System.out.print("\rCalculating relations: " + getPercent(fileIndex, totalFiles) + "% " + ("(" + fileIndex + "/" + totalFiles + ")"));
        fileIndex++;
    }
    System.out.println();
}
 
开发者ID:benas,项目名称:jql,代码行数:38,代码来源:RelationCalculator.java

示例11: doMerge

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
public AnnotationDeclaration doMerge(AnnotationDeclaration first, AnnotationDeclaration second) {

  AnnotationDeclaration ad = new AnnotationDeclaration();

  ad.setJavaDoc(mergeSingle(first.getJavaDoc(), second.getJavaDoc()));
  ad.setMembers(mergeCollections(first.getMembers(), second.getMembers()));
  ad.setAnnotations(mergeCollections(first.getAnnotations(), second.getAnnotations()));
  ad.setModifiers(mergeModifiers(first.getModifiers(), second.getModifiers()));

  return ad;
}
 
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:13,代码来源:AnnotationDeclarationMerger.java

示例12: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
public Node visit(AnnotationDeclaration _n, Object _arg) {
	JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
	List<BodyDeclaration> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	AnnotationDeclaration r = new AnnotationDeclaration(
			_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
			 _n.getModifiers(), annotations, _n.getName(), members
	);
	r.setComment(comment);
	return r;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:15,代码来源:CloneVisitor.java

示例13: doCompile

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
protected UnitCache<EmulTypeElement> doCompile(TypeDeclaration unit) {
    String unitName = unit.getName();

    String qualifiedName = TypeUtil.determineQualifiedName(
        getCompileUnit(), unit.getNameExpr());

    TypeMirror type = new EmulType(new StringName(qualifiedName), TypeKind.DECLARED);
    Name name = new StringName(unitName);

    ElementKind kind = ElementKind.OTHER;
    List<Element> members = new ArrayList<>();
    Set<Modifier> modifierSet = ModifierUtil.asSet(unit.getModifiers());

    if(unit instanceof AnnotationDeclaration) {
        kind = ElementKind.ANNOTATION_TYPE;
    } else if(unit instanceof EnumDeclaration) {
        kind = ElementKind.ENUM;
    } else if(unit instanceof ClassOrInterfaceDeclaration) {
        if(((ClassOrInterfaceDeclaration) unit).isInterface()) {
            kind = ElementKind.INTERFACE;
        } else {
            kind = ElementKind.CLASS;
        }
    }

    EmulTypeElement element = new EmulTypeElement(type, kind, parent, members,
        modifierSet, name, name, NestingKind.TOP_LEVEL);

    // Children
    NodeToElementCompiler compiler = new NodeToElementCompiler(getCompileUnit(), element);
    for(BodyDeclaration member : unit.getMembers()) {
        Element childElem = compiler.compile(member);
        if(childElem != null) {
            members.add(childElem);
        }
    }

    return new UnitCache<>(element);
}
 
开发者ID:BenDol,项目名称:Databind,代码行数:41,代码来源:NodeToTypeElementCompiler.java

示例14: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
public void visit(AnnotationDeclaration node, Object arg) {
    if (node == null) {
        return;
    }
    ensurePackageName(node);
    Log.d(TAG, "visit AnnotationDeclaration, name: %s", node.getName());
    classVisitor.inspectTypeDeclaration(sourceInfo, node, null, false);
}
 
开发者ID:ragnraok,项目名称:JParserUtil,代码行数:10,代码来源:SourceTreeVisitor.java

示例15: visit

import com.github.javaparser.ast.body.AnnotationDeclaration; //导入依赖的package包/类
@Override
public Node visit(AnnotationDeclaration _n, Object _arg) {
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
       List<BodyDeclaration<?>> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	AnnotationDeclaration r = new AnnotationDeclaration(
			_n.getRange(),
			 _n.getModifiers(), annotations, _n.getName(), members
	);
	r.setComment(comment);
	return r;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:14,代码来源:CloneVisitor.java


注:本文中的com.github.javaparser.ast.body.AnnotationDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。