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


Java Annotation.isSingleMemberAnnotation方法代码示例

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


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

示例1: obtainSingleMemberAnnotationValue

import org.eclipse.jdt.core.dom.Annotation; //导入方法依赖的package包/类
public static Expression obtainSingleMemberAnnotationValue(BodyDeclaration declaration, Class<?> annotationClass) {
	Annotation annotation = obtainAnnotation(declaration, annotationClass);
	if (annotation != null && annotation.isSingleMemberAnnotation()) {
		SingleMemberAnnotation singleMemberAnnot = (SingleMemberAnnotation) annotation;
		return singleMemberAnnot.getValue();
	}
	return null;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:9,代码来源:SharedUtils.java

示例2: mergeAnnotationAttributes

import org.eclipse.jdt.core.dom.Annotation; //导入方法依赖的package包/类
/**
 * Annotation attributes handlings for annotation's type located in the
 * generated annotation property file.
 * 
 * @param annotationInTheExistingFragment
 * @param existingAnnotation
 * @param lw
 * @param generatedAnnotations
 * @param annoName
 */
private void mergeAnnotationAttributes(Annotation annotationInTheExistingFragment,
		Annotation annotationInTheGeneratedFragment, ListRewrite lw) {

	if (annotationInTheExistingFragment.isMarkerAnnotation()) {
		/*
		 * The annotation used inside the existing fragment is a marker
		 * annotation (annotation without attribute)
		 */
		if (!annotationInTheGeneratedFragment.isMarkerAnnotation()) {
			/*
			 * The annotation used inside the generated fragment contains
			 * one or many attributes. The annotation used inside the
			 * generated fragment must be used in the result
			 */
			lw.replace(annotationInTheExistingFragment, annotationInTheGeneratedFragment, null);
		}
	} else {
		if (annotationInTheExistingFragment.isSingleMemberAnnotation()) {
			/*
			 * The annotation used inside the existing fragment is a single
			 * member annotation (annotation without only one attribute)
			 */
			if (annotationInTheGeneratedFragment.isSingleMemberAnnotation()) {
				/*
				 * The annotation used inside the generated fragment
				 * contains one value. Existing value must be replaced by
				 * generated value.
				 */

				this.astr.replace(annotationInTheExistingFragment, annotationInTheGeneratedFragment,
						null);
			} else {
				if (annotationInTheGeneratedFragment.isNormalAnnotation()) {
					/*
					 * The annotation used inside the generated fragment
					 * contains several attributes. Existing value must be
					 * replaced by generated value.
					 */
					lw.replace(annotationInTheExistingFragment,
							annotationInTheGeneratedFragment, null);
				}
			}
		} else {
			/*
			 * The annotation used inside the existing fragment is a normal
			 * annotation (annotation with several attributes)
			 */
			if (annotationInTheGeneratedFragment.isSingleMemberAnnotation()) {
				/*
				 * What should be done in that case ? The existing
				 * annotation has been probably enhance => Let the existing
				 * content as before.
				 */
			} else {
				if (annotationInTheGeneratedFragment.isNormalAnnotation()) {
					/*
					 * The annotation used inside the generated fragment
					 * contains several attributes. Existing and generated
					 * annotations must be merged.
					 */
					this.mergeAnnotationAttribute(
							(NormalAnnotation) annotationInTheExistingFragment,
							(NormalAnnotation) annotationInTheGeneratedFragment);
				}
			}
		}
	}
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:79,代码来源:DefaultMergingStrategy.java


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