本文整理汇总了Java中com.github.javaparser.ast.body.ConstructorDeclaration.getModifiers方法的典型用法代码示例。如果您正苦于以下问题:Java ConstructorDeclaration.getModifiers方法的具体用法?Java ConstructorDeclaration.getModifiers怎么用?Java ConstructorDeclaration.getModifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.body.ConstructorDeclaration
的用法示例。
在下文中一共展示了ConstructorDeclaration.getModifiers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override
public Node visit(ConstructorDeclaration _n, Object _arg) {
JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
List<Parameter> parameters = visit(_n.getParameters(), _arg);
List<NameExpr> throws_ = visit(_n.getThrows(), _arg);
BlockStmt block = cloneNodes(_n.getBlock(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
ConstructorDeclaration r = new ConstructorDeclaration(
_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
_n.getModifiers(), annotations, typeParameters, _n.getName(), parameters, throws_, block
);
r.setComment(comment);
return r;
}
示例2: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override
public Node visit(ConstructorDeclaration _n, Object _arg) {
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
List<Parameter> parameters = visit(_n.getParameters(), _arg);
List<ReferenceType> throws_ = visit(_n.getThrows(), _arg);
BlockStmt block = cloneNodes(_n.getBody(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
ConstructorDeclaration r = new ConstructorDeclaration(
_n.getRange(),
_n.getModifiers(), annotations, typeParameters, _n.getName(), parameters, throws_, block
);
r.setComment(comment);
return r;
}
示例3: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public Boolean visit(final ConstructorDeclaration n1, final Node arg) {
final ConstructorDeclaration n2 = (ConstructorDeclaration) 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 (!nodeEquals(n1.getBlock(), n2.getBlock())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例4: buildConstructorAST
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public void buildConstructorAST(ConstructorDeclaration constDec){
try{
this.text = printAndExtractText(constDec);
// Get all thrown Exceptions
for(ReferenceType type: constDec.getThrows()){
this.exceptions.add(type.toString());
}
this.name = constDec.getName();
Node parent = constDec.getParentNode();
if (parent instanceof ClassOrInterfaceDeclaration){
this.className = ((ClassOrInterfaceDeclaration) parent).getName();
}
this.modifier = constDec.getModifiers();
this.returnType = this.className;
this.paramTypes = getParamTypes(constDec);
// Get Annotations
for(AnnotationExpr annotExpr: constDec.getAnnotations()){
this.annotations.add(annotExpr.getName().toString());
}
// If JavaDocs present, extract them
if (constDec.getJavaDoc() != null){
this.javaDoc = cleanDocumentation(constDec.getJavaDoc().getContent());
}
this.comments = extractContainedComments(constDec);
// These are in-line comments just before the method definitition
if (constDec.getComment() != null){
if (this.comments == null){
this.comments = "";
}
this.comments += constDec.getComment().getContent();
}
// Recursively loop through child nodes and make a dictionary
this.parseBody(constDec.getBlock());
this.extractHighLevelConcepts();
} catch (Exception ex){
ex.printStackTrace();
}
}