本文整理汇总了Java中com.github.javaparser.ast.expr.MarkerAnnotationExpr类的典型用法代码示例。如果您正苦于以下问题:Java MarkerAnnotationExpr类的具体用法?Java MarkerAnnotationExpr怎么用?Java MarkerAnnotationExpr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MarkerAnnotationExpr类属于com.github.javaparser.ast.expr包,在下文中一共展示了MarkerAnnotationExpr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOrFindMarkerAnnotation
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
protected MarkerAnnotationExpr createOrFindMarkerAnnotation(BodyDeclaration<?> getter, String fullAnnotationName) {
String name = AbstractGenerator.finalName(fullAnnotationName);
importIf(fullAnnotationName);
//getUnit().addImport(fullAnnotationName);
for(AnnotationExpr annotationExpr : getter.getAnnotations()) {
String annName = annotationExpr.getName().asString();
if(annName.equals(fullAnnotationName) || name.equals(annName)) {
return (MarkerAnnotationExpr) annotationExpr;
}
}
String pkg = AbstractGenerator.packageName(fullAnnotationName);
NodeList<MemberValuePair> nodes = NodeList.nodeList();
//Name nm = new Name(new Name(pkg), name);
MarkerAnnotationExpr ax = new MarkerAnnotationExpr(new Name(name));
getter.addAnnotation(ax);
return ax;
}
示例2: parseResource
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
public static Option<ResourceDocumentation> parseResource(CompilationUnit root) {
return fold(root.getChildrenNodes(), ClassOrInterfaceDeclaration.class, none(), (maybeDoc, decl) ->
maybeDoc.orElse(() ->
walk(decl, SingleMemberAnnotationExpr.class).exists(hasName("path")) ?
some(walk(decl, MethodDeclaration.class).foldLeft((rDoc, mDelc) ->
walk(mDelc, SingleMemberAnnotationExpr.class).exists(hasName("path")) || walk(mDelc, MarkerAnnotationExpr.class).exists(or(hasName("get"), hasName("post"))) ?
rDoc.append(
new MethodDocumentation(
ofType(mDelc.getChildrenNodes(), SingleMemberAnnotationExpr.class).filter(hasName("path")).headOption().map(a -> rDoc.path + normalizeUrl(a.getMemberValue().toString())).orSome(rDoc.path),
ofType(mDelc.getChildrenNodes(), MarkerAnnotationExpr.class).filter(or(hasName("get"), hasName("post"))).headOption().map(a -> a.getName().getName()).orSome("GET"),
ofType(mDelc.getChildrenNodes(), SingleMemberAnnotationExpr.class).filter(hasName("rolesallowed")).headOption().map(a -> arrayList(a.getMemberValue().toString().split(","))).orSome(nil()).map(role->StringUtils.remove(role,"\"")),
mDelc.getComment() != null ? mDelc.getComment().getContent() : "",
iterableList(mDelc.getParameters()).map(Node::toString),
nil())) :
rDoc,
new ResourceDocumentation(
ofType(decl.getChildrenNodes(), SingleMemberAnnotationExpr.class).filter(hasName("path")).headOption().map(a -> a.getMemberValue().toString()).map(Strings::normalizeUrl).orSome("/"),
ofType(decl.getChildrenNodes(), SingleMemberAnnotationExpr.class).filter(hasName("rolesallowed")).headOption().map(a -> arrayList(a.getMemberValue().toString().split(","))).orSome(nil()),
decl.getComment() == null ? "" : decl.getComment().getContent(),
nil()))) :
none()));
}
示例3: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override
public void visit(final MarkerAnnotationExpr n, final Object arg) {
printer.printLn("MarkerAnnotationExpr");
printJavaComment(n.getComment(), arg);
printer.print("@");
n.getName().accept(this, arg);
}
示例4: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override
public JCTree visit(final MarkerAnnotationExpr n, final Object arg) {
/* TODO - Currently not supporting annotations
JCTree result = n.getName().accept(this, arg);
return new AJCMarkerAnnotation( make.MarkerAnnotation( ), ( (n.getComment()!=null)?n.getComment().getContent():null ) );
*/
System.err.println("Assigning null at:" + Thread.currentThread().getStackTrace()[1].getLineNumber());
return null;
}
示例5: doMerge
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override
public MarkerAnnotationExpr doMerge(MarkerAnnotationExpr first, MarkerAnnotationExpr second) {
MarkerAnnotationExpr mae = new MarkerAnnotationExpr();
mae.setName(mergeSingle(first.getName(),second.getName()));
return mae;
}
示例6: parsePlugin
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
public static Option<String> parsePlugin(CompilationUnit root) {
return fold(root.getChildrenNodes(), ClassOrInterfaceDeclaration.class, none(), (maybeDoc, decl) ->
maybeDoc.orElse(() ->
walk(decl, MarkerAnnotationExpr.class).exists(hasName("plugin")) ?
Option.fromNull(decl.getComment()).map(Comment::getContent) :
none()
));
}
示例7: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override public Boolean visit(final MarkerAnnotationExpr n1, final Node arg) {
final MarkerAnnotationExpr n2 = (MarkerAnnotationExpr) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
return false;
}
return true;
}
示例8: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override
public Node visit(MarkerAnnotationExpr _n, Object _arg) {
NameExpr name = cloneNodes(_n.getName(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
MarkerAnnotationExpr r = new MarkerAnnotationExpr(
_n.getRange(),
name
);
r.setComment(comment);
return r;
}
示例9: addMarkerAnnotation
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
/**
* Annotates this with a marker annotation
*
* @param name the name of the annotation
* @return this
*/
@SuppressWarnings("unchecked")
public default T addMarkerAnnotation(String name) {
MarkerAnnotationExpr markerAnnotationExpr = new MarkerAnnotationExpr(
name(name));
getAnnotations().add(markerAnnotationExpr);
markerAnnotationExpr.setParentNode((Node) this);
return (T) this;
}
示例10: createOrFindMarkerAnnotation
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
protected MarkerAnnotationExpr createOrFindMarkerAnnotation(BodyDeclaration<?> getter, String fullAnnotationName) {
return m_classWrapper.createOrFindMarkerAnnotation(getter, fullAnnotationName);
}
示例11: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override
public void visit(MarkerAnnotationExpr n, Script arg) {
}
示例12: doIsEquals
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override
public boolean doIsEquals(MarkerAnnotationExpr first, MarkerAnnotationExpr second) {
return first.getName().equals(second.getName());
}
示例13: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override public Node visit(final MarkerAnnotationExpr n, final A arg) {
n.setName((NameExpr) n.getName().accept(this, arg));
return n;
}
示例14: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override public void visit(final MarkerAnnotationExpr n, final A arg) {
visitComment(n.getComment(), arg);
n.getName().accept(this, arg);
}
示例15: visit
import com.github.javaparser.ast.expr.MarkerAnnotationExpr; //导入依赖的package包/类
@Override public Node visit(final MarkerAnnotationExpr n, final A arg) {
visitComment(n, arg);
n.setName((NameExpr) n.getName().accept(this, arg));
return n;
}