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

Java Expression类代码示例

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

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



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

示例1: getAnnotationNodes

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
    final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass);
    if (joinColumns != null && joinColumns.size() > 1) {
        final Comment fixme = new BlockComment("\nFIXME: JPA_CONVERSION\n"
                + "For compound primary keys, make sure the join columns are in the correct order.\n");
        AnnotationExpr
                annotation = new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new ArrayInitializerExpr(joinColumns));
        annotation.setComment(fixme);
        return new NodeData(annotation,
                new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
                Arrays.asList(
                          new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PrimaryKeyJoinColumnResolver.PACKAGE),PrimaryKeyJoinColumnResolver.SIMPLE_NAME), false, false)
                        , new ImportDeclaration(new QualifiedNameExpr(new NameExpr(JoinColumnResolver.PACKAGE),JoinColumnResolver.SIMPLE_NAME), false, false)
                        ));
    }

    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:JoinColumnsResolver.java


示例2: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
public void visit(SingleMemberAnnotationExpr expression, Object arg)
{	// annotation de type @SuppressWarnings("javadoc")
	NameExpr name = expression.getName();
	if(name.getName().equalsIgnoreCase("SuppressWarnings"))
	{	Expression expr = expression.getMemberValue();
		if(expr instanceof StringLiteralExpr)
		{	StringLiteralExpr sle = (StringLiteralExpr) expr;
			if(sle.getValue().equalsIgnoreCase("javadoc"))
			{	int line = expression.getBeginLine();
				printErr("Erreur ligne "+line+" : utilisation de l'annotation SuppressWarnings sur 'javadoc'. Il faut supprimer cette annotation et compléter la Javadoc.");
				errorCount++;
			}
		}
	}
	//NOTE ne traite pas le cas où on a plusieurs membres, e.g. @SuppressWarnings({"javadoc","xxxx"})
}
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:18,代码来源:AiVisitor.java


示例3: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
public void visit(SingleMemberAnnotationExpr expression, Object arg)
{	// annotation de type @SuppressWarnings("javadoc")
	NameExpr name = expression.getName();
	if(name.getName().equalsIgnoreCase("SuppressWarnings"))
	{	Expression expr = expression.getMemberValue();
		if(expr instanceof StringLiteralExpr)
		{	StringLiteralExpr sle = (StringLiteralExpr) expr;
			if(sle.getValue().equalsIgnoreCase("javadoc"))
			{	int line = expression.getBeginLine();
				printErr("Erreur ligne "+line+" : utilisation de l'annotation SuppressWarnings sur 'javadoc'. Il faut supprimer cette annotation et compléter la Javadoc.");
				errorCount++;
			}
		}
	}
	//ne traite pas le cas où on a plusieurs membres, e.g. @SuppressWarnings({"javadoc","xxxx"})
}
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:18,代码来源:AiVisitor.java


示例4: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
public void visit(SingleMemberAnnotationExpr expression, Object arg)
{	// annotation de type @SuppressWarnings("javadoc")
	NameExpr name = expression.getName();
	if(name.getName().equalsIgnoreCase("SuppressWarnings"))
	{	Expression expr = expression.getMemberValue();
		if(expr instanceof StringLiteralExpr)
		{	StringLiteralExpr sle = (StringLiteralExpr) expr;
			if(sle.getValue().equalsIgnoreCase("javadoc"))
			{	int line = expression.getBeginLine();
				printErr("Erreur ligne "+line+" : utilisation de l'annotation SuppressWarnings sur 'javadoc'. Il faut supprimer cette annotation et compléter la Javadoc.");
				errorCount++;
			}
		}
	}
	//
}
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:18,代码来源:AiVisitor.java


示例5: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
public R visit(ExplicitConstructorInvocationStmt n, A arg) {
    if (!n.isThis()) {
        if (n.getExpr() != null) {
            n.getExpr().accept(this, arg);
        }
    }
    if (n.getTypeArgs() != null) {
        for (Type t : n.getTypeArgs()) {
            t.accept(this, arg);
        }
    }
    if (n.getArgs() != null) {
        for (Expression e : n.getArgs()) {
            e.accept(this, arg);
        }
    }
    return null;
}
 
开发者ID:rfw,项目名称:genja,代码行数:19,代码来源:GenericVisitorAdapter.java


示例6: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
public void visit(ArrayCreationExpr n, Object arg) {
    printer.print("new ");
    n.getType().accept(this, arg);

    if (n.getDimensions() != null) {
        for (Expression dim : n.getDimensions()) {
            printer.print("[");
            dim.accept(this, arg);
            printer.print("]");
        }
        for (int i = 0; i < n.getArrayCount(); i++) {
            printer.print("[]");
        }
    } else {
        for (int i = 0; i < n.getArrayCount(); i++) {
            printer.print("[]");
        }
        printer.print(" ");
        n.getInitializer().accept(this, arg);
    }
}
 
开发者ID:rfw,项目名称:genja,代码行数:22,代码来源:DumpVisitor.java


示例7: visit

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


示例8: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
public Node visit(AnnotationMemberDeclaration n, A arg) {
    if (n.getJavaDoc() != null) {
        n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg));
    }
    List<AnnotationExpr> annotations = n.getAnnotations();
    if (annotations != null) {
        for (int i = 0; i < annotations.size(); i++) {
            annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
        }
        removeNulls(annotations);
    }
    n.setType((Type) n.getType().accept(this, arg));
    if (n.getDefaultValue() != null) {
        n.setDefaultValue((Expression) n.getDefaultValue().accept(this, arg));
    }
    return n;
}
 
开发者ID:rfw,项目名称:genja,代码行数:18,代码来源:ModifierVisitorAdapter.java


示例9: getAnnotationNodes

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
    final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass);
    if (joinColumns != null && joinColumns.size() == 1) {
        return new NodeData((AnnotationExpr) joinColumns.get(0),
                new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false));
    }

    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:JoinColumnResolver.java


示例10: getAnnotationNodes

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
    final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass);
    if (joinColumns != null && joinColumns.size() > 1) {
        final Comment fixme = new BlockComment("\nFIXME: JPA_CONVERSION\n"
                + "For compound primary keys, make sure the join columns are in the correct order.\n");
        AnnotationExpr annotation = new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new ArrayInitializerExpr(joinColumns));
        annotation.setComment(fixme);
        return new NodeData(annotation,
                new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
                Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "PrimaryKeyJoinColumn"), false, false)));
    }

    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:PrimaryKeyJoinColumnsResolver.java


示例11: getAnnotationNodes

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
        final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass);
        if (joinColumns != null && joinColumns.size() == 1) {
            return new NodeData((AnnotationExpr) joinColumns.get(0),
                    new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false));
        }

    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:PrimaryKeyJoinColumnResolver.java


示例12: getJoinColumns

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
protected final List<Expression> getJoinColumns(String enclosingClass, String fieldName, String mappedClass) {
    final ObjectReferenceDescriptor ord = OjbUtil.findObjectReferenceDescriptor(mappedClass, fieldName,
            descriptorRepositories);

    final CollectionDescriptor cld = OjbUtil.findCollectionDescriptor(mappedClass, fieldName,
            descriptorRepositories);

    if (ord != null) {
        return processReferenceField(enclosingClass, fieldName, mappedClass, ord);
    } else if (cld != null) {
        return processCollectionField(enclosingClass, fieldName, mappedClass, cld);
    }

    return Collections.emptyList();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:AbstractJoinColumnResolver.java


示例13: processReferenceField

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
private List<Expression> processReferenceField(String enclosingClass, String fieldName, String mappedClass, ObjectReferenceDescriptor ord) {
    final List<Expression> joinColumns = new ArrayList<Expression>();
    final Collection<String> fks = ord.getForeignKeyFields();
    if (fks == null || fks.isEmpty()) {
        LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a reference descriptor for " + fieldName
                + " but does not have any foreign keys configured");
        return joinColumns;
    }

    final Collection<String> pks = OjbUtil.getPrimaryKeyNames(mappedClass, descriptorRepositories);

    //make sure it isn't a one to one
    if (!(pks.containsAll(fks) && fks.containsAll(pks)) && !pks.isEmpty()) {

        final ClassDescriptor cd = OjbUtil.findClassDescriptor(mappedClass, descriptorRepositories);
        final ClassDescriptor icd = getItemClassDescriptor(enclosingClass, fieldName, mappedClass, ord);
        final FieldDescriptor[] fkDescs = ord.getForeignKeyFieldDescriptors(cd);
        final FieldDescriptor[] pkDescs = icd.getPkFields();

        if (fkDescs.length != pkDescs.length) {
            LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a collection descriptor for " + fieldName
                    + " with an foreign key that is not joined to all of the primary key fields. This is not supported in JPA.");
        }

        for (int i = 0; i < fkDescs.length; i ++) {
            joinColumns.add(createJoinColumn(fkDescs[i], pkDescs[i]));
        }
    }
    return joinColumns;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:AbstractJoinColumnResolver.java


示例14: processCollectionField

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
private List<Expression> processCollectionField(String enclosingClass, String fieldName, String mappedClass, CollectionDescriptor cld) {
    final List<Expression> joinColumns = new ArrayList<Expression>();

    if (!cld.isMtoNRelation()) {
        final Collection<String> fks = cld.getForeignKeyFields();
        if (fks == null || fks.isEmpty()) {
            LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a collection descriptor for " + fieldName
                    + " but does not have any inverse foreign keys configured");
            return joinColumns;
        }

        final ClassDescriptor cd = OjbUtil.findClassDescriptor(mappedClass, descriptorRepositories);
        final ClassDescriptor icd = getItemClassDescriptor(enclosingClass, fieldName, mappedClass, cld);
        final FieldDescriptor[] fkDescs =  cld.getForeignKeyFieldDescriptors(icd);
        final FieldDescriptor[] pkDescs = cd.getPkFields();

        if (fkDescs.length != pkDescs.length) {
            LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a collection descriptor for " + fieldName
            + " with an inverse foreign key that is not joined to all of the primary key fields.  This is not supported in JPA.");
        }

        for (int i = 0; i < fkDescs.length; i ++) {
            joinColumns.add(createJoinColumn(pkDescs[i], fkDescs[i]));
        }
    }
    return joinColumns;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:AbstractJoinColumnResolver.java


示例15: makeLoopCondition

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
/**
 * Make a loop condition enforced.
 */
private static Statement makeLoopCondition(Expression cond) {
    if (cond == null) return null;

    return new IfStmt(new UnaryExpr(cond, UnaryExpr.Operator.not),
                      new BreakStmt(null), null);
}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:LoopDesugarTransform.java


示例16: visit

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
@Override
public Node visit(ExpressionStmt n, Map<String, TypedVariableDeclarator> arg) {
    Node r = n.getExpression().accept(this, arg);

    if (n.getExpression() instanceof VariableDeclarationExpr) {
        // Rewrite variable declarations -- we have to turn them into
        // sepcial things.
        VariableDeclarationExpr expr = (VariableDeclarationExpr) n.getExpression();
        List<Statement> assigns = new ArrayList<Statement>();

        for (VariableDeclarator d : expr.getVars()) {
            if (d.getInit() != null){
                assigns.add(new ExpressionStmt(new AssignExpr(new NameExpr(this.block.getScopePrefix() + d.getId().getName()),
                                                              d.getInit(),
                                                              AssignExpr.Operator.assign)));
            }
        }

        if (assigns.size() == 0) {
            return null;
        }

        if (assigns.size() == 1) {
            return assigns.get(0);
        }
        return new BlockStmt(assigns);
    }

    if (r == null) {
        return null;
    }

    return new ExpressionStmt((Expression) r);
}
 
开发者ID:rfw,项目名称:genja,代码行数:35,代码来源:ScopeMangleTransform.java


示例17: addNotification

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
private void addNotification(MethodDeclaration method, String text) {
	MethodCallExpr e = new MethodCallExpr(new NameExpr("Notification"), "show");
	e.setArgs(Collections.singletonList((Expression)new StringLiteralExpr(text)));
	Statement statement = new ExpressionStmt(e);
	addToMethod(method, statement);
	ensureImport("com.vaadin.ui.Notification");
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:8,代码来源:ControllerCode.java


示例18: ExplicitConstructorInvocationStmt

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
public ExplicitConstructorInvocationStmt(int beginLine, int beginColumn, int endLine, int endColumn, List<Type> typeArgs, boolean isThis, Expression expr, List<Expression> args) {
    super(beginLine, beginColumn, endLine, endColumn);
    this.typeArgs = typeArgs;
    this.isThis = isThis;
    this.expr = expr;
    this.args = args;
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:ExplicitConstructorInvocationStmt.java


示例19: ForStmt

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
public ForStmt(int beginLine, int beginColumn, int endLine, int endColumn, List<Expression> init, Expression compare, List<Expression> update, Statement body) {
    super(beginLine, beginColumn, endLine, endColumn);
    this.compare = compare;
    this.init = init;
    this.update = update;
    this.body = body;
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:ForStmt.java


示例20: AnnotationMemberDeclaration

import japa.parser.ast.expr.Expression; //导入依赖的package包/类
public AnnotationMemberDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, Type type, String name, Expression defaultValue) {
    super(annotations, javaDoc);
    this.modifiers = modifiers;
    this.type = type;
    this.name = name;
    this.defaultValue = defaultValue;
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:AnnotationMemberDeclaration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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