@Override public Node visit(Parameter _n, Object _arg) { List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg); Type type_ = cloneNodes(_n.getType(), _arg); VariableDeclaratorId id = cloneNodes(_n.getId(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); Parameter r = new Parameter( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getModifiers(), annotations, type_, _n.isVarArgs(), id ); r.setComment(comment); return r; }
@Override public void visit(final Parameter n, final A arg) { visitComment(n.getComment(), arg); if (n.getAnnotations() != null) { for (final AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); n.getId().accept(this, arg); }
@Override public void visit(final Parameter n, final Object arg) { printJavaComment(n.getComment(), arg); printAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); if (n.isVarArgs()) { printer.print("..."); } printer.print(" "); n.getId().accept(this, arg); }
@Override public R visit(final Parameter n, final A arg) { if (n.getAnnotations() != null) { for (final AnnotationExpr a : n.getAnnotations()) { { R result = a.accept(this, arg); if (result != null) { return result; } } } } { R result = n.getType().accept(this, arg); if (result != null) { return result; } } { R result = n.getId().accept(this, arg); if (result != null) { return result; } } return null; }
/** * Creates a new {@link Parameter}. * * @param type * type of the parameter * @param name * name of the parameter * @return instance of {@link Parameter} */ public static Parameter createParameter(Type type, String name) { return new Parameter(type, new VariableDeclaratorId(name)); }
public void visit(CatchClause n, Object arg) { printer.print(" catch ("); n.getExcept().accept(this, arg); printer.print(") "); n.getCatchBlock().accept(this, arg); }
AnnotationExpr annotation = param.getAnnotations().get(0); param.getAnnotations().clear(); file.assertSave(); param.getAnnotations().add(annotation); file.assertSave();
public String getName() { return parameter.getId().getName(); }
public void visit(Parameter n, Object arg) { printAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); if (n.isVarArgs()) { printer.print("..."); } printer.print(" "); n.getId().accept(this, arg); }
private NodeAndImports<MethodDeclaration> createPrimaryKeyCompareTo(Collection<FieldDescriptor> primaryKeyDescriptors, String enclosingClassName) { final MethodDeclaration compareTo = new MethodDeclaration(ModifierSet.PUBLIC, new PrimitiveType(PrimitiveType.Primitive.Int), "compareTo", Collections.singletonList(new Parameter(new ClassOrInterfaceType(enclosingClassName), new VariableDeclaratorId("other")))); compareTo.setAnnotations(Collections.<AnnotationExpr>singletonList(new MarkerAnnotationExpr(new NameExpr("Override")))); Expression compareToBuilderExpr = new ObjectCreationExpr(null, new ClassOrInterfaceType("CompareToBuilder"), Collections.<Expression>emptyList()); for (FieldDescriptor f : primaryKeyDescriptors) { final List<Expression> args = new ArrayList<Expression>(); args.add(new FieldAccessExpr(new ThisExpr(), f.getAttributeName())); args.add(new FieldAccessExpr(new NameExpr("other"), f.getAttributeName())); compareToBuilderExpr = new MethodCallExpr(compareToBuilderExpr, "append", args); } compareToBuilderExpr = new MethodCallExpr(compareToBuilderExpr, "toComparison"); final List<Statement> statements = new ArrayList<Statement>(); statements.add(new ReturnStmt(compareToBuilderExpr)); final BlockStmt equalsBody = new BlockStmt(statements); compareTo.setBody(equalsBody); return new NodeAndImports<MethodDeclaration>(compareTo, Collections.singleton(new ImportDeclaration(new QualifiedNameExpr(new NameExpr("org.apache.commons.lang.builder"), "CompareToBuilder"), false, false))); }
if (parameters != null) { for (int i = 0; i < parameters.size(); i++) { parameters.set(i, (Parameter) parameters.get(i).accept(this, arg));
public String getType() { return parameter.getType().toString(); } }
AnnotationExpr annotation = param.getAnnotations().get(0); param.getAnnotations().clear(); file.assertSave(); param.getAnnotations().add(annotation); file.assertSave();
final public Parameter FormalParameter() throws ParseException { Modifier modifier; Type type; boolean isVarArg = false; VariableDeclaratorId id; modifier = Modifiers(); type = Type(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ELLIPSIS: jj_consume_token(ELLIPSIS); isVarArg = true; break; default: jj_la1[42] = jj_gen; ; } id = VariableDeclaratorId(); int line = modifier.beginLine; int column = modifier.beginColumn; if(line==-1){ line=type.getBeginLine(); column=type.getBeginColumn(); } {if (true) return new Parameter(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, isVarArg, id);} throw new Error("Missing return statement in function"); }
if (parameters != null) { for (int i = 0; i < parameters.size(); i++) { parameters.set(i, (Parameter) parameters.get(i).accept(this, arg));
final public Parameter FormalParameter() throws ParseException { Modifier modifier; Type type; boolean isVarArg = false; VariableDeclaratorId id; modifier = Modifiers(); type = Type(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ELLIPSIS: jj_consume_token(ELLIPSIS); isVarArg = true; break; default: jj_la1[42] = jj_gen; ; } id = VariableDeclaratorId(); int line = modifier.beginLine; int column = modifier.beginColumn; if(line==-1){ line=type.getBeginLine(); column=type.getBeginColumn(); } Parameter tmp = new Parameter(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, isVarArg, id); {if (true) return tmp;} throw new Error("Missing return statement in function"); }
for (Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) { Parameter p = i.next(); p.accept(this, arg); if (i.hasNext()) { printer.print(", ");
Collections.singletonList(new Parameter(new ClassOrInterfaceType(simpleTypeName), new VariableDeclaratorId(attrName))));