Java源码示例:com.github.javaparser.ast.body.AnnotationMemberDeclaration
示例1
@Override
public void visit(final AnnotationMemberDeclaration n, final Void arg) {
printJavaComment(n.getComment(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());
n.getType().accept(this, arg);
printer.print(" ");
n.getName().accept(this, arg);
printer.print("()");
if (n.getDefaultValue().isPresent()) {
printer.print(" default ");
n.getDefaultValue().get().accept(this, arg);
}
printer.print(";");
}
示例2
@Override
public void visit(AnnotationMemberDeclaration n, Object arg) {
if (!currentClassDoc.isAnnotationType()) {
throw new GroovyBugError("Annotation member definition found when not expected");
}
SimpleGroovyFieldDoc fieldDoc = new SimpleGroovyFieldDoc(n.getNameAsString(), currentClassDoc);
fieldDoc.setType(makeType(n.getType()));
setModifiers(n.getModifiers(), fieldDoc);
fieldDoc.setPublic(true);
processAnnotations(fieldDoc, n);
currentClassDoc.add(fieldDoc);
n.getJavadocComment().ifPresent(javadocComment ->
fieldDoc.setRawCommentText(javadocComment.getContent()));
n.getDefaultValue().ifPresent(defValue -> {
fieldDoc.setRawCommentText(fieldDoc.getRawCommentText() + "\n* @default " + defValue.toString());
fieldDoc.setConstantValueExpression(defValue.toString());
});
super.visit(n, arg);
}
示例3
@Override
public AnnotationMemberDeclaration doMerge(AnnotationMemberDeclaration first, AnnotationMemberDeclaration second) {
AnnotationMemberDeclaration amd = new AnnotationMemberDeclaration();
amd.setName(first.getName());
amd.setType(mergeSingle(first.getType(),second.getType()));
amd.setJavaDoc(mergeSingle(first.getJavaDoc(), second.getJavaDoc()));
amd.setModifiers(mergeModifiers(first.getModifiers(), second.getModifiers()));
amd.setAnnotations(mergeCollections(first.getAnnotations(), second.getAnnotations()));
amd.setDefaultValue(mergeSingle(first.getDefaultValue(), second.getDefaultValue()));
return amd;
}
示例4
@Override
public boolean doIsEquals(AnnotationMemberDeclaration first, AnnotationMemberDeclaration second) {
if (!isEqualsUseMerger(first.getType(), second.getType())) return false;
if (!first.getName().equals(second.getName())) return false;
return true;
}
示例5
public void index(AnnotationMemberDeclaration annotationMemberDeclaration, int typeId) {
methodDao.save(new Method(annotationMemberDeclaration.getNameAsString(),
annotationMemberDeclaration.isPublic(), false, false, annotationMemberDeclaration.isAbstract(), false, typeId));
}
示例6
@Override
public void visit(AnnotationMemberDeclaration n, Void arg) {
out.println("AnnotationMemberDeclaration: " + (extended ? n : ""));
super.visit(n, arg);
}