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

Java SingleMemberAnnotationExpr类代码示例

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

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



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

示例1: resolve

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
@Override
public NodeData resolve(Node node, String mappedClass) {
    if (!(node instanceof ClassOrInterfaceDeclaration)) {
        throw new IllegalArgumentException("this annotation belongs only on ClassOrInterfaceDeclaration");
    }

    final TypeDeclaration dclr = (TypeDeclaration) node;
    if (!(dclr.getParentNode() instanceof CompilationUnit)) {
        //handling nested classes
        return null;
    }
    final String name = dclr.getName();

    final Collection<FieldDescriptor> primaryKeyDescriptors = getPrimaryKeyDescriptors(mappedClass);

    if (primaryKeyDescriptors != null && primaryKeyDescriptors.size() > 1  && nodeContainsPkFields(dclr,
            primaryKeyDescriptors)) {
        final NodeAndImports<ClassOrInterfaceDeclaration> primaryKeyClass = createPrimaryKeyClass(name, primaryKeyDescriptors);
        final String pkClassName = primaryKeyClass.node.getName();
        return new NodeData(new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new NameExpr(name + "." + pkClassName + ".class")),
                new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false), primaryKeyClass.imprts, primaryKeyClass.node);

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


示例2: getAnnotationNodes

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
/** gets the annotation but also adds an import in the process if a Convert annotation is required. */
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
    final CollectionDescriptor cld = OjbUtil.findCollectionDescriptor(mappedClass, fieldName, descriptorRepositories);
    if (cld != null) {
        Collection<FieldHelper> orderBy = cld.getOrderBy();
        if (orderBy != null && !orderBy.isEmpty()) {
            String orderByStr = "";
            for (FieldHelper fh : orderBy) {
                orderByStr += fh.name + (fh.isAscending ? "" : " DESC") + ", ";
            }
            orderByStr = orderByStr.replaceAll(", $", "");
            return new NodeData(new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new StringLiteralExpr(orderByStr)),
                    new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false));
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:OrderByResolver.java


示例3: resolve

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
@Override
public NodeData resolve(Node node, String mappedClass) {
    if (!(node instanceof ClassOrInterfaceDeclaration)) {
        throw new IllegalArgumentException("this annotation belongs only on ClassOrInterfaceDeclaration");
    }

    final TypeDeclaration dclr = (TypeDeclaration) node;
    if (!(dclr.getParentNode() instanceof CompilationUnit)) {
        //handling nested classes
        return null;
    }
    final String name = dclr.getName();
    final String pckg = ((CompilationUnit) dclr.getParentNode()).getPackage().getName().toString();
    final String enclosingClass = pckg + "." + name;
    final Collection<String> customizedFieldsOnNode = getFieldsOnNode(dclr, getCustomizedFields(mappedClass));
    if (customizedFieldsOnNode == null || customizedFieldsOnNode.isEmpty()) {
        LOG.info(ResolverUtil.logMsgForClass(enclosingClass, mappedClass) + " has no customized fields");
        return null;
    }
    return new NodeData(new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new NameExpr("CreateCustomizerFor" + customizedFieldsOnNode.toString())),
            new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:CustomizerResolver.java


示例4: getAnnotationNodes

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的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


示例5: visit

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的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


示例6: visit

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的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


示例7: visit

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的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


示例8: isClaraHandler

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
private static boolean isClaraHandler(MethodDeclaration method, String id,
		String className) {
	if (method.getAnnotations()==null) {
		return false;
	}
	for (AnnotationExpr ann : method.getAnnotations()) {
		if ("UiHandler".equals(ann.getName().getName())) {
			if (ann instanceof SingleMemberAnnotationExpr) {
				SingleMemberAnnotationExpr smae = (SingleMemberAnnotationExpr)ann;
				if (smae.getMemberValue() instanceof StringLiteralExpr) {
					String v = ((StringLiteralExpr)smae.getMemberValue()).getValue();
					if (id.equals(v)) {
						return hasOneParamWithType(method, className);
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:21,代码来源:ControllerCode.java


示例9: isClaraField

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
private static boolean isClaraField(FieldDeclaration field, String id,
		String className) {
	if (field.getAnnotations()==null) {
		return false;
	}
	for (AnnotationExpr ann : field.getAnnotations()) {
		if ("UiField".equals(ann.getName().getName())) {
			if (ann instanceof SingleMemberAnnotationExpr) {
				SingleMemberAnnotationExpr smae = (SingleMemberAnnotationExpr)ann;
				if (smae.getMemberValue() instanceof StringLiteralExpr) {
					String v = ((StringLiteralExpr)smae.getMemberValue()).getValue();
					if (id.equals(v)) {
						return true;
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:21,代码来源:ControllerCode.java


示例10: getAnnotationNodes

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
    final FieldDescriptor fd = OjbUtil.findFieldDescriptor(mappedClass, fieldName, descriptorRepositories);

    if (fd != null) {
        final Class<?> fc = ResolverUtil.getType(enclosingClass, fieldName);
        final String columnType = fd.getColumnType();
        if (isJavaSqlDate(fc)) {
            LOG.warn(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " is a java.sql.Date. " + getWarnMessageFragment(columnType));
        } else if (isJavaSqlTimestamp(fc)) {
            LOG.warn(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " is a java.sql.Timestamp. " + getWarnMessageFragment(columnType));
        } else if (isJavaSqlTime(fc)) {
            LOG.warn(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " is a java.sql.Time. " + getWarnMessageFragment(columnType));
        } else if (isJavaUtilDate(fc) || isJavaUtilCalendar(fc)) {
            if (DATE.equals(columnType)) {
                return new NodeData(new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new NameExpr("TemporalType.DATE")),
                        new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
                        Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "TemporalType"), false, false)));
            } else if (TIMESTAMP.equals(columnType)) {
                return new NodeData(new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new NameExpr("TemporalType.TIMESTAMP")),
                        new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
                        Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "TemporalType"), false, false)));
            } else if (TIME.equals(columnType)) {
                return new NodeData(new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new NameExpr("TemporalType.TIME")),
                        new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
                        Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "TemporalType"), false, false)));
            }

            LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " is a java.sql.Date or java.util.Calendar but the column type " + columnType + " is unknown.  Unable to add @Temporal annotation");
        }

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


示例11: getAnnotationNodes

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的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


示例12: getNestedClassNames

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
private static String[ ] getNestedClassNames( TypeDeclaration decl )
{
	SingleMemberAnnotationExpr fullNameAnnot = ( SingleMemberAnnotationExpr ) decl.getAnnotations( ).get( 0 );
	StringLiteralExpr fullNameExpr = ( StringLiteralExpr ) fullNameAnnot.getMemberValue( );
	
	String fullName = fullNameExpr.getValue( );
	
	int lastDot = fullName.lastIndexOf( '.' );
	return fullName.substring( lastDot + 1 ).split( "\\$" );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:11,代码来源:BuilderGenerator.java


示例13: findJavaFile

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
private static File findJavaFile( TypeDeclaration builderParentDecl )
{
	SingleMemberAnnotationExpr fullNameAnnot = ( SingleMemberAnnotationExpr ) builderParentDecl.getAnnotations( ).get( 0 );
	StringLiteralExpr fullNameExpr = ( StringLiteralExpr ) fullNameAnnot.getMemberValue( );
	
	String fullName = fullNameExpr.getValue( );
	
	int lastDot = fullName.lastIndexOf( '.' );
	String path = fullName.substring( 0 , lastDot ).replace( '.' , File.separatorChar );
	String[ ] classNames = fullName.substring( lastDot + 1 ).split( "\\$" );
	
	String filePath = path + File.separator + classNames[ 0 ] + ".java";
	return FileFinder.findFile( filePath , new File( "applet/src" ) , 2 );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:15,代码来源:BuilderGenerator.java


示例14: visit

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
public Boolean visit(SingleMemberAnnotationExpr n1, Node arg) {
    SingleMemberAnnotationExpr n2 = (SingleMemberAnnotationExpr) arg;

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

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

    return Boolean.TRUE;
}
 
开发者ID:rfw,项目名称:genja,代码行数:14,代码来源:EqualsVisitor.java


示例15: visit

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


示例16: visit

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


示例17: visit

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


示例18: visit

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


示例19: visit

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
public R visit(SingleMemberAnnotationExpr n, A arg) {
    n.getName().accept(this, arg);
    n.getMemberValue().accept(this, arg);
    return null;
}
 
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:GenericVisitorAdapter.java


示例20: visit

import japa.parser.ast.expr.SingleMemberAnnotationExpr; //导入依赖的package包/类
public void visit(SingleMemberAnnotationExpr n, A arg) {
    n.getName().accept(this, arg);
    n.getMemberValue().accept(this, arg);
}
 
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:VoidVisitorAdapter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Hierarchy类代码示例发布时间:2022-05-22
下一篇:
Java NTypeMerger类代码示例发布时间: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