本文整理汇总了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;
}
示例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);
}
}
}
}
}