本文整理汇总了Java中com.github.javaparser.ast.body.VariableDeclaratorId.getArrayCount方法的典型用法代码示例。如果您正苦于以下问题:Java VariableDeclaratorId.getArrayCount方法的具体用法?Java VariableDeclaratorId.getArrayCount怎么用?Java VariableDeclaratorId.getArrayCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.body.VariableDeclaratorId
的用法示例。
在下文中一共展示了VariableDeclaratorId.getArrayCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParamTypes
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
private ArrayList<String> getParamTypes(Node n){
ArrayList<String> paramTypes = new ArrayList<String>();
List<Parameter> params = new ArrayList<Parameter>();
if(n instanceof MethodDeclaration){
params = ((MethodDeclaration) n).getParameters();
}else if(n instanceof ConstructorDeclaration){
params = ((ConstructorDeclaration) n).getParameters();
}
for (Parameter param : params) {
boolean isArray = false;
for(Node node : param.getChildrenNodes()){
if(node instanceof VariableDeclaratorId){
VariableDeclaratorId id = (VariableDeclaratorId) node;
if(id.getArrayCount() > 0){
// This would be the case when var's are declared like String args[], but we want to extract String [] as parameter
isArray = true;
}
}
}
if(isArray){
paramTypes.add(param.getType().toString() + "[]");
}
else{
paramTypes.add(param.getType().toString());
}
}
return paramTypes;
}
示例2: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
@Override
public void visit(final VariableDeclaratorId n, final Object arg) {
printer.printLn("VariableDeclaratorId");
printJavaComment(n.getComment(), arg);
printer.print(n.getName());
for (int i = 0; i < n.getArrayCount(); i++) {
printer.print("[]");
}
}
示例3: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
@Override public Boolean visit(final VariableDeclaratorId n1, final Node arg) {
final VariableDeclaratorId n2 = (VariableDeclaratorId) arg;
if (n1.getArrayCount() != n2.getArrayCount()) {
return Boolean.FALSE;
}
if (!objEquals(n1.getName(), n2.getName())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例4: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
@Override
public Node visit(VariableDeclaratorId _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclaratorId r = new VariableDeclaratorId(
_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
_n.getName(), _n.getArrayCount()
);
r.setComment(comment);
return r;
}
示例5: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
@Override public void visit(final VariableDeclaratorId n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print(n.getName());
for (int i = 0; i < n.getArrayCount(); i++) {
printer.print("[]");
}
}
示例6: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
@Override public void visit(final VariableDeclaratorId n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print(n.getName());
for (int i = 0; i < n.getArrayCount(); i++) {
printer.print("[]");
}
}
示例7: doIsEquals
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入方法依赖的package包/类
@Override
public boolean doIsEquals(VariableDeclaratorId first, VariableDeclaratorId second) {
if(!StringUtils.equals(first.getName(),second.getName())) return false;
if(first.getArrayCount() != second.getArrayCount()) return false;
return true;
}