Examples of PackageDeclaration


Examples of com.sun.mirror.declaration.PackageDeclaration

  }

  @Override
  public String convert(TypeDeclaration declaration) throws TemplateModelException {
    PackageDeclaration pkg = declaration.getPackage();
    String convertedPackage = convertPackage(pkg);
    String simpleName = declaration.getSimpleName();
    return convertedPackage + getPackageSeparator() + simpleName;
  }
View Full Code Here

Examples of japa.parser.ast.PackageDeclaration

        cu.setComment(comment);
        return this;
    }

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

Examples of japa.parser.ast.PackageDeclaration

    private static final Logger LOG = LoggerFactory.getLogger(JavaParserCreateCU.class);

    public static void main(String[] args) {
        CompilationUnit cu = new CompilationUnit();
        //set the package
        cu.setPackage(new PackageDeclaration(ASTHelper.createNameExpr("cn.shenyanchao.javaparser.test")));
        //create the type declaration
        ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false, "HelloWorld");
        ASTHelper.addTypeDeclaration(cu, type);
        //create a method
        MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "main");
View Full Code Here

Examples of japa.parser.ast.PackageDeclaration

        CompilationUnit compilationUnit = JavaParserFactory.getCompilationUnit(javaFile, sourceEncode);

        CompilationUnitBuilder compilationUnitBuilder = new CompilationUnitBuilder();
        compilationUnitBuilder.buildComment(FileComments.GENERATOR_COMMENT);
        //process package
        PackageDeclaration packageDeclaration = compilationUnit.getPackage();
        String testPackageName = PackageUtils.getTestPackageNameFrom(packageDeclaration);
        compilationUnitBuilder.buildPackage(testPackageName);
        //process import

        //process type
View Full Code Here

Examples of japa.parser.ast.PackageDeclaration

public class InformerTextGenerator {

  public static CompilationUnit generateVisibleInformer(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

Examples of japa.parser.ast.PackageDeclaration

  }

  public static CompilationUnit generateAbstractInformer(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

Examples of japa.parser.ast.PackageDeclaration

        // NB: this import list is replaced at the end of this method by a
        // sorted version
        compilationUnit.setImports(new ArrayList<ImportDeclaration>());

        if (!cid.getName().isDefaultPackage()) {
            compilationUnit.setPackage(new PackageDeclaration(ASTHelper
                    .createNameExpr(cid.getName().getPackage()
                            .getFullyQualifiedPackageName())));
        }

        // Add the class of interface declaration to the compilation unit
View Full Code Here

Examples of lombok.ast.PackageDeclaration

    ImportList il = new ImportList();
   
    while (n != null) {
      if (n instanceof CompilationUnit) {
        CompilationUnit cu = (CompilationUnit) n;
        PackageDeclaration pkg = cu.astPackageDeclaration();
        if (pkg != null) il.stars.add(pkg.getPackageName());
        for (ImportDeclaration imp : cu.astImportDeclarations()) {
          if (imp.astStaticImport()) continue;
          if (imp.astStarImport()) {
            String i = imp.asFullyQualifiedName();
            i = i.substring(0, i.length() - 2);
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration

    protected void doAdditionalClassChecks( ClassDeclaration jpfClass )
    {
        // Make sure there are no other page flows in this package/directory.
        checkForOverlappingClasses( jpfClass, JPF_BASE_CLASS, JPF_FILE_EXTENSION_DOT, "error.overlapping-pageflows" );
       
        PackageDeclaration pkg = jpfClass.getPackage();
        File jpfFile = CompilerUtils.getSourceFile( jpfClass, true );
        File parentDir = jpfFile.getParentFile();
       
        //
        // Check the package name.
        //
        String jpfPackageName = pkg.getQualifiedName();
       
        if ( jpfPackageName != null && jpfPackageName.length() > 0 )
        {
            String expectedPackage = parentDir.getAbsolutePath().replace( '\\', '/' ).replace( '/', '.' );
           
            if ( ! expectedPackage.endsWith( jpfPackageName ) )
            {
                getDiagnostics().addError( jpfClass, "error.wrong-package-for-directory", parentDir.getPath() );
            }
        }

        //
        // Issue a warning if the class name is the same as the parent package name.
        // This causes ambiguity when resolving inner classes.
        //
        if ( jpfClass.getSimpleName().equals( pkg.getQualifiedName() ) )
        {
            getDiagnostics().addWarning( jpfClass, "warning.classname-same-as-package" );
        }
       
        //
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration

    protected void checkForOverlappingClasses( ClassDeclaration jpfClass, String baseClass, String fileExtension,
                                               String errorKey )
    {
        File jpfFile = CompilerUtils.getSourceFile( jpfClass, true );
        File parentDir = jpfFile.getParentFile();
        PackageDeclaration pkg = jpfClass.getPackage();
        ClassDeclaration[] packageClasses = pkg.getClasses();
        Set overlapping = new HashSet();
        List overlappingFiles = new ArrayList();
       
        //
        // First go through the other classes in this package to look for other classes of this type.  Only one per
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.