当前位置: 首页>>代码示例>>Java>>正文


Java BodyDeclaration.getAnnotations方法代码示例

本文整理汇总了Java中japa.parser.ast.body.BodyDeclaration.getAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java BodyDeclaration.getAnnotations方法的具体用法?Java BodyDeclaration.getAnnotations怎么用?Java BodyDeclaration.getAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在japa.parser.ast.body.BodyDeclaration的用法示例。


在下文中一共展示了BodyDeclaration.getAnnotations方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findAnnotation

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
private AnnotationExpr findAnnotation(final BodyDeclaration n, String fullyQualifiedName, boolean foundAnnImport) {
    final String simpleName = ClassUtils.getShortClassName(fullyQualifiedName);
    final List<AnnotationExpr> annotations = n.getAnnotations() != null ? n.getAnnotations() : new ArrayList<AnnotationExpr>();

    for (AnnotationExpr ae : annotations) {
        final String name = ae.getName().toString();
        if ((simpleName.equals(name) && foundAnnImport)) {
            LOG.info("found " + ae + " on " + getTypeOrFieldNameForMsg(n) + ".");
            return ae;
        }

        if (fullyQualifiedName.equals(name)) {
            LOG.info("found " + ae + " on " + getTypeOrFieldNameForMsg(n) + ".");
            return ae;
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:AnnotationHelper.java

示例2: getTotalLineRegion

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
private static LineRegion getTotalLineRegion( BodyDeclaration decl )
{
	LineRegion region = getLineRegion( decl );
	if( decl.getJavaDoc( ) != null )
	{
		region = region.union( getLineRegion( decl.getJavaDoc( ) ) );
	}
	if( decl.getAnnotations( ) != null )
	{
		for( AnnotationExpr annotation : decl.getAnnotations( ) )
		{
			region = region.union( getLineRegion( annotation ) );
		}
	}
	return region;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:17,代码来源:BuilderGenerator.java

示例3: addAnnotationTo

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
public static void addAnnotationTo(BodyDeclaration aDeclaration, AnnotationExpr aAnnotation) {
    if (aDeclaration.getAnnotations() != null) {
        aDeclaration.getAnnotations().add(aAnnotation);
    } else {
        List<AnnotationExpr> theExpressions = new ArrayList<>();
        theExpressions.add(aAnnotation);
        aDeclaration.setAnnotations(theExpressions);
    }
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:10,代码来源:OpenXavaASTHelper.java

示例4: getAnnotation

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
public static AnnotationExpr getAnnotation(BodyDeclaration decl, Class<?> annotationClass) {
	for (AnnotationExpr annotation : decl.getAnnotations()) {
		if (annotation.getName().equals(annotationClass.getSimpleName()) ||
				annotation.getName().equals(annotationClass.getName())) {
			return annotation;
		}
	}

	return null;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:11,代码来源:JavaParserUtils.java

示例5: fullRegion

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
public static LineRegion fullRegion(Node node) {
	LineRegion result = region(node);
	if (node instanceof BodyDeclaration) {
		BodyDeclaration bodyDecl = (BodyDeclaration) node;
		if (bodyDecl.getAnnotations() != null) {
			for (AnnotationExpr annotation : bodyDecl.getAnnotations()) {
				result = result.union(region(annotation));
			}
		}
		if (bodyDecl.getJavaDoc() != null) {
			result = result.union(region(bodyDecl.getJavaDoc()));
		}
	}
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:16,代码来源:LineUtils.java

示例6: containsAnnotation

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
private boolean containsAnnotation(BodyDeclaration methodDeclaration, String annotation) {
    if (methodDeclaration.getAnnotations() != null) {
        for (AnnotationExpr annotationExpr : methodDeclaration.getAnnotations()) {
            if (annotation.equals(annotationExpr.getName().toString())) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:slezier,项目名称:SimpleFunctionalTest,代码行数:11,代码来源:UseCaseJavaParser.java

示例7: hasAnnotation

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
private static boolean hasAnnotation(BodyDeclaration decl, String anno) {
    if (decl.getAnnotations() == null) {
        return false;
    }
    for (AnnotationExpr ae : decl.getAnnotations()) {
        if (anno.equals(ae.getName().toString())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:12,代码来源:JavaUtil.java

示例8: processAnnotations

import japa.parser.ast.body.BodyDeclaration; //导入方法依赖的package包/类
private void processAnnotations(BodyDeclaration decl) {
    if (decl.getAnnotations() != null)
        for (AnnotationExpr expr : decl.getAnnotations())
            attributes.add(expr.getName().toString());
}
 
开发者ID:amritbhat786,项目名称:DocIT,代码行数:6,代码来源:Fact.java


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