Package japa.parser.ast

Examples of japa.parser.ast.PackageDeclaration


*/
public class JavaParserUtils {
    private static final Logger LOG = LoggerFactory.getLogger(JavaParserUtils.class);

    public static String findTestPackageName(CompilationUnit sourceCU) {
        PackageDeclaration packageDeclaration = sourceCU.getPackage();
        String testPackageName = PackageUtils.getTestPackageNameFrom(packageDeclaration);
        return testPackageName;
    }
View Full Code Here


        cu.setComments(comments);
        return this;
    }

    public CompilationUnitBuilder buildPackage(String packageName) {
        cu.setPackage(new PackageDeclaration(ASTHelper.createNameExpr(packageName)));
        return this;
    }
View Full Code Here

        String className = typeDeclaration.getName();
        ClassTypeBuilder classTypeBuilder = new ClassTypeBuilder(className + Consts.TEST_SUFFIX);

        List<Comment> existComments = testCU.getComments();
        compilationUnitBuilder.addComments(existComments);
        PackageDeclaration existPackageDeclaration = testCU.getPackage();
        compilationUnitBuilder.addPackage(existPackageDeclaration);
        //process import
        List<ImportDeclaration> existImports = testCU.getImports();
        compilationUnitBuilder.addImports(existImports);
        //process methods
View Full Code Here

        return Boolean.TRUE;
    }

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

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

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

        return Boolean.TRUE;
    }
View Full Code Here

/*
* Program structuring syntax follows.
*/
    final public CompilationUnit CompilationUnit() throws ParseException {
        PackageDeclaration pakage = null;
        List imports = null;
        ImportDeclaration in = null;
        List types = null;
        TypeDeclaration tn = null;
        int line = -1;
        int column = 0;
        if (jj_2_1(2147483647)) {
            pakage = PackageDeclaration();
            line = pakage.getBeginLine();
            column = pakage.getBeginColumn();
        } else {
            ;
        }
        label_1: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
View Full Code Here

        column = token.beginColumn;
        name = Name();
        jj_consume_token(SEMICOLON);
        {
            if (true) {
                return new PackageDeclaration(line, column, token.endLine, token.endColumn, annotations, name);
            }
        }
        throw new Error("Missing return statement in function");
    }
View Full Code Here

public class InformerTextGenerator {

  public static CompilationUnit generateCompilationUnit(InformerInfos informerInfos, Collection<String> qualifiedEnums, Map<String, Class> resolvedInformers) {
    CompilationUnit cu = new CompilationUnit();
    // set the package
    cu.setPackage(new PackageDeclaration(ASTHelper.createNameExpr(informerInfos.classPackage)));

    // Finally add imports (they may have been "improved" by informers generation)
    List<ImportDeclaration> baseImports = informerInfos.imports;
    // Extracting effective imports
    Collection<String> imports = new LinkedList<String>();
View Full Code Here

public class InformerTextGenerator {

  public static CompilationUnit generateCompilationUnit(InformerInfos informerInfos, Collection<String> qualifiedEnums, Map<String, Class> resolvedInformers) {
    CompilationUnit cu = new CompilationUnit();
    // set the package
    cu.setPackage(new PackageDeclaration(ASTHelper.createNameExpr(informerInfos.classPackage)));

    // Finally add imports (they may have been "improved" by informers generation)
    List<ImportDeclaration> baseImports = informerInfos.imports;
    // Extracting effective imports
    Collection<String> imports = new LinkedList<String>();
View Full Code Here

    mm.getQueue().clear();
    Tools.serialize(b, ser);

    //
    JavaFile pkgFile = helper.assertJavaSource("metamodel.application.package-info");
    PackageDeclaration pkg = pkgFile.assertPackage();
    pkg.getAnnotations().clear();
    List<AnnotationExpr> a = Collections.<AnnotationExpr>singletonList(new NormalAnnotationExpr(ASTHelper.createNameExpr(
        Application.class.getName()),
        Collections.<MemberValuePair>singletonList(new MemberValuePair(
            "name", new StringLiteralExpr("abc")
        ))));
    pkg.setAnnotations(a);
    pkgFile.assertSave();

    //
    helper.assertCompile();
    ser = helper.getSourceOutput().getPath("juzu", "metamodel.ser");
View Full Code Here

    CompilerAssert<File, File> helper = incrementalCompiler("metamodel.application");
    helper.assertCompile();

    //
    JavaFile pkgFile = helper.assertJavaSource("metamodel.application.package-info");
    PackageDeclaration pkg = pkgFile.assertPackage();
    pkg.getAnnotations().clear();
    pkgFile.assertSave();

    //
    helper.assertCompile();
View Full Code Here

TOP

Related Classes of japa.parser.ast.PackageDeclaration

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.