Package japa.parser.ast.body

Examples of japa.parser.ast.body.Parameter


            return false;
         }

         for (int i = 0; i < parameterTypes.length; i++) {
            Class<?> paramType = parameterTypes[i];
            Parameter param = parameters.get(i);

            if (!paramType.getSimpleName().equals(param.getType().toString())) {
               return false;
            }
         }

         return true;
View Full Code Here


     * @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));
    }
View Full Code Here

        MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "main");
        method.setModifiers(ModifierSet.addModifier(method.getModifiers(), ModifierSet.STATIC));
        ASTHelper.addMember(type, method);

        //add a parameter to the method
        Parameter param = ASTHelper.createParameter(ASTHelper.createReferenceType("String", 1), "args");
//        param.setVarArgs(true);
        ASTHelper.addParameter(method, param);

        //add a body to the method
        BlockStmt block = new BlockStmt();
View Full Code Here

        return Boolean.TRUE;
    }

    public Boolean visit(Parameter n1, Node arg) {
        Parameter n2 = (Parameter) arg;

        if (n1.getModifiers() != n2.getModifiers()) {
            return Boolean.FALSE;
        }

        if (!nodeEquals(n1.getId(), n2.getId())) {
            return Boolean.FALSE;
        }

        if (!nodeEquals(n1.getType(), n2.getType())) {
            return Boolean.FALSE;
        }

        if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
            return Boolean.FALSE;
        }

        return Boolean.TRUE;
    }
View Full Code Here

        printer.print(n.getName());

        printer.print("(");
        if (n.getParameters() != null) {
            for (Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
                Parameter p = i.next();
                p.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }
View Full Code Here

        printer.print(n.getName());

        printer.print("(");
        if (n.getParameters() != null) {
            for (Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
                Parameter p = i.next();
                p.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }
View Full Code Here

        throw new Error("Missing return statement in function");
    }

    final public List FormalParameters() throws ParseException {
        List ret = null;
        Parameter par;
        jj_consume_token(LPAREN);
        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case ABSTRACT:
            case BOOLEAN:
            case BYTE:
View Full Code Here

            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");
    }
View Full Code Here

    final public TryStmt TryStatement() throws ParseException {
        BlockStmt tryBlock;
        BlockStmt finallyBlock = null;
        List catchs = null;
        Parameter except;
        BlockStmt catchBlock;
        int line;
        int column;
        int cLine;
        int cColumn;
View Full Code Here

    for (BodyDeclaration decl : bean.getMembers()) {
      if (decl instanceof MethodDeclaration) {
        index = (MethodDeclaration)decl;
      }
    }
    Parameter param = index.getParameters().get(0);
    AnnotationExpr annotation = param.getAnnotations().get(0);
    param.getAnnotations().clear();
    file.assertSave();
//      helper.assertRemove("metamodel", "param", "A.java");

    // Recompile
    // we should have a way to test the error kind more precisely
    /*List<CompilationError> errors = */helper.assertCompile();
    // assertEquals(1, errors.size());

    // Add back @Param
    param.getAnnotations().add(annotation);
    file.assertSave();

    // Recompile
    helper.assertCompile();

View Full Code Here

TOP

Related Classes of japa.parser.ast.body.Parameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.