Examples of NameExpr


Examples of japa.parser.ast.expr.NameExpr

        //add a body to the method
        BlockStmt block = new BlockStmt();
        method.setBody(block);

        //add a statement do the method body
        NameExpr clazz = new NameExpr("System");
        FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
        MethodCallExpr call = new MethodCallExpr(field, "println");
        ASTHelper.addArgument(call, new StringLiteralExpr("Hello World"));
        ASTHelper.addStmt(block, call);
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

    public static String getTestPackageNameFrom(PackageDeclaration packageDeclaration) {
        if (null == packageDeclaration) {
            return Consts.TEST_PACKAGE;
        } else {
            NameExpr packageNameExpr = packageDeclaration.getName();
            String packageName = packageNameExpr.toString();
            return packageName + "." + Consts.TEST_PACKAGE;
        }
    }
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

        return this;
    }

    public CompilationUnitBuilder buildImports(String[] imports) {

        ImportDeclaration importDeclaration = new ImportDeclaration(new NameExpr("org.testng.annotations.Test"),
                false, false);
        if (null != cu.getImports()) {
            cu.getImports().add(importDeclaration);
        } else {
            cu.setImports(Arrays.asList(importDeclaration));
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

    public ClassTypeBuilder buildMethod(String methodName, MethodDeclaration method, String... params) {

        method.setName(methodName);
//        MarkerAnnotationExpr markerAnnotationExpr = new MarkerAnnotationExpr(new NameExpr("Test"));
        List<MemberValuePair> memberValuePairs = new ArrayList<MemberValuePair>();
        memberValuePairs.add(new MemberValuePair("description", new NameExpr("\"申艳超的测试用例\"")));
        NormalAnnotationExpr normalAnnotationExpr = new NormalAnnotationExpr(new NameExpr("Test"), memberValuePairs);
        List<AnnotationExpr> annotationExprList = new ArrayList<AnnotationExpr>();
//        annotationExprList.add(markerAnnotationExpr);
        annotationExprList.add(normalAnnotationExpr);
        if (null != method.getParameters()) {
            method.getParameters().clear();
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

        return Boolean.TRUE;
    }

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

        if (!objEquals(n1.getName(), n2.getName())) {
            return Boolean.FALSE;
        }

        return Boolean.TRUE;
    }
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

        printer.print(")");

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

Examples of japa.parser.ast.expr.NameExpr

        }

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

Examples of japa.parser.ast.expr.NameExpr

    }

    final public PackageDeclaration PackageDeclaration() throws ParseException {
        List annotations = null;
        AnnotationExpr ann;
        NameExpr name;
        int line;
        int column;
        label_3: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case AT:
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

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

    final public ImportDeclaration ImportDeclaration() throws ParseException {
        NameExpr name;
        boolean isStatic = false;
        boolean isAsterisk = false;
        int line;
        int column;
        jj_consume_token(IMPORT);
View Full Code Here

Examples of japa.parser.ast.expr.NameExpr

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

    final public NameExpr Name() throws ParseException {
        NameExpr ret;
        jj_consume_token(IDENTIFIER);
        ret = new NameExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image);
        label_23: while (true) {
            if (jj_2_17(2)) {
                ;
            } else {
                break label_23;
            }
            jj_consume_token(DOT);
            jj_consume_token(IDENTIFIER);
            ret = new QualifiedNameExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, token.image);
        }
        {
            if (true) {
                return ret;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.