本文整理汇总了Java中com.github.javaparser.ast.expr.ArrayInitializerExpr.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayInitializerExpr.getValues方法的具体用法?Java ArrayInitializerExpr.getValues怎么用?Java ArrayInitializerExpr.getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.expr.ArrayInitializerExpr
的用法示例。
在下文中一共展示了ArrayInitializerExpr.getValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.expr.ArrayInitializerExpr; //导入方法依赖的package包/类
@Override
public void visit(final ArrayInitializerExpr n, final Object arg) {
printer.printLn("ArrayInitializerExpr");
printJavaComment(n.getComment(), arg);
printer.print("{");
if (n.getValues() != null) {
printer.print(" ");
for (final Iterator<Expression> i = n.getValues().iterator(); i.hasNext(); ) {
final Expression expr = i.next();
expr.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
printer.print(" ");
}
printer.print("}");
}
示例2: visit
import com.github.javaparser.ast.expr.ArrayInitializerExpr; //导入方法依赖的package包/类
@Override
public JCTree visit(final ArrayInitializerExpr n, final Object arg) {
//ARG0: JCExpression elemtype
// This is for the type of elements in, e.g., int[][] a = {{1,2},{3,4}};
// Field not necessary
JCExpression arg0 = null;
//ARG1: List<JCExpression> dims
// Field not necessary.
List<JCExpression> arg1 = List.<JCExpression>nil();
//ARG2: List<JCExpression> elems
List<JCExpression> arg2 = List.<JCExpression>nil();
if (n.getValues() != null) {
for (final Expression expr : n.getValues()) {
arg2 = arg2.append((JCExpression) expr.accept(this, arg));
}
}
return new AJCNewArray(make.NewArray(arg0, arg1, arg2), null);
}
示例3: parseArrayInitializerExpression
import com.github.javaparser.ast.expr.ArrayInitializerExpr; //导入方法依赖的package包/类
/**
*
* @param arryInEx
* a github javaparser ArrayInitializerExpression
* @param attributes
* the list of attributes of the class,
* to potentially get a type from the name
* @param lineNumber
* the starting line number of the parse method or constructor
* @return
* an Array literal structure
*/
private ArrayLit parseArrayInitializerExpression(ArrayInitializerExpr arryInEx, List<Attribute> attributes, int lineNumber) {
ArrayLit arryLit = new ArrayLit();
ArrayType arrayType = new ArrayType();
List<Integer> dimensions = new ArrayList<>();
if (arryInEx.getValues() != null) {
dimensions.addAll(ParserUtils.extractDimensions(arryInEx.getValues()));
}
arrayType.setDimensions(dimensions);
arryLit.setType(arrayType);
List<Expr> elements = new ArrayList<>();
if (arryInEx.getValues() != null) {
for (Expression expr : arryInEx.getValues()) {
elements.add(parseExpression(expr, attributes, lineNumber));
}
}
arryLit.setElements(elements);
return arryLit;
}
示例4: visit
import com.github.javaparser.ast.expr.ArrayInitializerExpr; //导入方法依赖的package包/类
@Override public Node visit(final ArrayInitializerExpr n, final A arg) {
if (n.getValues() != null) {
final List<Expression> values = n.getValues();
if (values != null) {
for (int i = 0; i < values.size(); i++) {
values.set(i, (Expression) values.get(i).accept(this, arg));
}
removeNulls(values);
}
}
return n;
}
示例5: visit
import com.github.javaparser.ast.expr.ArrayInitializerExpr; //导入方法依赖的package包/类
@Override public void visit(final ArrayInitializerExpr n, final A arg) {
visitComment(n.getComment(), arg);
if (n.getValues() != null) {
for (final Expression expr : n.getValues()) {
expr.accept(this, arg);
}
}
}
示例6: visit
import com.github.javaparser.ast.expr.ArrayInitializerExpr; //导入方法依赖的package包/类
@Override public Node visit(final ArrayInitializerExpr n, final A arg) {
visitComment(n, arg);
if (n.getValues() != null) {
final List<Expression> values = n.getValues();
if (values != null) {
for (int i = 0; i < values.size(); i++) {
values.set(i, (Expression) values.get(i).accept(this, arg));
}
removeNulls(values);
}
}
return n;
}