Package com.bacoder.parser.java.api

Examples of com.bacoder.parser.java.api.CompilationUnit


    super(adapters);
  }

  @Override
  public CompilationUnit adapt(CompilationUnitContext context) {
    CompilationUnit compilationUnit = createNode(context);

    PackageDeclarationContext packageDeclarationContext =
        getChild(context, PackageDeclarationContext.class);
    if (packageDeclarationContext != null) {
      compilationUnit.setPackageDeclaration(
          getAdapter(PackageDeclarationAdapter.class).adapt(packageDeclarationContext));
    }

    List<ImportDeclaration> importDeclarationas =
        transform(context, ImportDeclarationContext.class, new Function<ImportDeclarationContext,
            ImportDeclaration>() {
          @Override
          public ImportDeclaration apply(ImportDeclarationContext context) {
            return getAdapter(ImportDeclarationAdapter.class).adapt(context);
          }
        });
    compilationUnit.setImportDeclarations(importDeclarationas);

    List<TypeDeclaration> typeDeclarations =
        transform(context, TypeDeclarationContext.class, new Function<TypeDeclarationContext,
            TypeDeclaration>() {
          @Override
          public TypeDeclaration apply(TypeDeclarationContext context) {
            return getAdapter(TypeDeclarationAdapter.class).adapt(context);
          }
        });
    compilationUnit.setTypeDeclarations(typeDeclarations);

    return compilationUnit;
  }
View Full Code Here

TOP

Related Classes of com.bacoder.parser.java.api.CompilationUnit

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.