• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PackageDeclaration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中japa.parser.ast.PackageDeclaration的典型用法代码示例。如果您正苦于以下问题:Java PackageDeclaration类的具体用法?Java PackageDeclaration怎么用?Java PackageDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PackageDeclaration类属于japa.parser.ast包,在下文中一共展示了PackageDeclaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCompilationUnitContents

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public final String getCompilationUnitContents(
        final ClassOrInterfaceTypeDetails cid) {
    Validate.notNull(cid, "Class or interface type details are required");
    // Create a compilation unit to store the type to be created
    final CompilationUnit compilationUnit = new CompilationUnit();

    // 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
    final List<TypeDeclaration> types = new ArrayList<TypeDeclaration>();
    compilationUnit.setTypes(types);

    updateOutput(compilationUnit, null, cid, null);

    return compilationUnit.toString();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:JavaParserTypeParsingService.java


示例2: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public void visit(PackageDeclaration declaration, Object arg)
{	String pack = declaration.getName().toString();

	// on met à jour le package de l'API courante
	apiPackage = AiPackageTools.getApiPackage(pack);

	// on met à jour le package du pack courant
	packPackage = AiPackageTools.getPackPackage(pack);
	
	// on met à jour le package de l'agent courant
	agentPackage = AiPackageTools.getAgentPackage(pack,true);
	
	// on met à jour la classe mère de l'agent courant
	agentClass = AiPackageTools.getAgentPackage(pack,false) + ClassTools.CLASS_SEPARATOR + "AiMain";
}
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:17,代码来源:AiVisitor.java


示例3: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public Node visit(CompilationUnit n, A arg) {
    if (n.getPackage() != null) {
        n.setPackage((PackageDeclaration) n.getPackage().accept(this, arg));
    }
    List<ImportDeclaration> imports = n.getImports();
    if (imports != null) {
        for (int i = 0; i < imports.size(); i++) {
            imports.set(i, (ImportDeclaration) imports.get(i).accept(this, arg));
        }
        removeNulls(imports);
    }
    List<TypeDeclaration> types = n.getTypes();
    if (types != null) {
        for (int i = 0; i < types.size(); i++) {
            types.set(i, (TypeDeclaration) types.get(i).accept(this, arg));
        }
        removeNulls(types);
    }
    return n;
}
 
开发者ID:rfw,项目名称:genja,代码行数:21,代码来源:ModifierVisitorAdapter.java


示例4: createNewCompilationUnit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
private CompilationUnit createNewCompilationUnit(String aPackageName, String aMainTypeName) {
    CompilationUnit theUnit = new CompilationUnit();
    if (!StringUtils.isEmpty(aPackageName)) {
        theUnit.setPackage(new PackageDeclaration(ASTHelper.createNameExpr(aPackageName)));
    }
    List<ImportDeclaration> theImports = new ArrayList<>();
    theImports.add(new ImportDeclaration(ASTHelper.createNameExpr("java.util"), false, true));
    theImports.add(new ImportDeclaration(ASTHelper.createNameExpr("javax.persistence"), false, true));
    theImports.add(new ImportDeclaration(ASTHelper.createNameExpr("org.openxava.annotations"), false, true));
    theUnit.setImports(theImports);
    ClassOrInterfaceDeclaration theType = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false, aMainTypeName);
    ASTHelper.addTypeDeclaration(theUnit, theType);
    return theUnit;
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:15,代码来源:OpenXavaGenerator.java


示例5: buildUnit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public static void buildUnit() {
    CompilationUnit compUnit = new CompilationUnit();
    
    compUnit.setPackage(new PackageDeclaration(ASTHelper
                                               .createNameExpr("compiladores.aula")));
    
    // create the type declaration
    ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(
                                                                       ModifierSet.PUBLIC, false, "AulaJavaParser");
    ASTHelper.addTypeDeclaration(compUnit, type);
    
    // create a method
    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", 0), "args");
    param.setVarArgs(true); //makes the parameter a ",,," array
    ASTHelper.addParameter(method, param);
    
    // 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);
    
    System.out.println(compUnit.toString());
}
 
开发者ID:damorim,项目名称:compilers-cin,代码行数:38,代码来源:ParserExample.java


示例6: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public R visit(PackageDeclaration n, A arg) {
    if (n.getAnnotations() != null) {
        for (AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    n.getName().accept(this, arg);
    return null;
}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:GenericVisitorAdapter.java


示例7: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
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;
}
 
开发者ID:rfw,项目名称:genja,代码行数:14,代码来源:EqualsVisitor.java


示例8: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public void visit(PackageDeclaration n, Object arg) {
    printAnnotations(n.getAnnotations(), arg);
    printer.print("package ");
    n.getName().accept(this, arg);
    printer.printLn(";");
    printer.printLn();
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:DumpVisitor.java


示例9: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public void visit(PackageDeclaration n, A arg) {
    if (n.getAnnotations() != null) {
        for (AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    n.getName().accept(this, arg);
}
 
开发者ID:rfw,项目名称:genja,代码行数:9,代码来源:VoidVisitorAdapter.java


示例10: tesCompilationUnitNotEqual

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Test
public void tesCompilationUnitNotEqual() throws Exception {
    String source = Helper.readClass("./test", DumperTestClass.class);
    CompilationUnit cu1 = Helper.parserString(source);
    CompilationUnit cu2 = Helper.parserString(source);

    cu2.setPackage(new PackageDeclaration(new NameExpr("diff_package")));
    assertNotEqualsAndHashCode(cu1, cu2);
}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:TestHashCodeEquals.java


示例11: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public void visit(PackageDeclaration n, Generator arg) {
    throw new TransformException("don't know how to linearize");
}
 
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:LinearizeTransform.java


示例12: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public Boolean visit(PackageDeclaration n, Void arg) {
    return false;
}
 
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:NodeAnnotator.java


示例13: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public void visit(PackageDeclaration n, Scope arg) {
    super.visit(n, arg);
    n.setData(arg);
}
 
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:ScopeCollector.java


示例14: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public void visit(PackageDeclaration n, Object arg) {
    doTest(source, n);
    super.visit(n, arg);
}
 
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:TestNodePositions.java


示例15: createInitialCu

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
private static CompilationUnit createInitialCu(String projPackage) {
	CompilationUnit newCu = new CompilationUnit();
	newCu.setPackage(new PackageDeclaration(new NameExpr(projPackage)));
	return newCu;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:6,代码来源:ControllerCode.java


示例16: visitPre

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public void visitPre(PackageDeclaration n, A arg) {
    
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java


示例17: visitPost

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
@Override
public void visitPost(PackageDeclaration n, A arg) {
    
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java


示例18: visitPre

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
void visitPre(PackageDeclaration n, A arg); 
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java


示例19: visitPost

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
void visitPost(PackageDeclaration n, A arg); 
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java


示例20: visit

import japa.parser.ast.PackageDeclaration; //导入依赖的package包/类
public R visit(PackageDeclaration n, A arg); 
开发者ID:rfw,项目名称:genja,代码行数:2,代码来源:GenericVisitor.java



注:本文中的japa.parser.ast.PackageDeclaration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RubySymbol类代码示例发布时间:2022-05-22
下一篇:
Java Condition类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap