本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.getAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.getAnnotations方法的具体用法?Java ReferenceBinding.getAnnotations怎么用?Java ReferenceBinding.getAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
的用法示例。
在下文中一共展示了ReferenceBinding.getAnnotations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inheritsAnno
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
/**
* Check whether an element has a superclass that is annotated with an @Inherited annotation.
* @param element must be a class (not an interface, enum, etc.).
* @param anno must be an annotation type, and must be @Inherited
* @return true if element has a superclass that is annotated with anno
*/
private boolean inheritsAnno(ReferenceBinding element, ReferenceBinding anno) {
ReferenceBinding searchedElement = element;
do {
if (searchedElement instanceof ParameterizedTypeBinding) {
searchedElement = ((ParameterizedTypeBinding) searchedElement).genericType();
}
AnnotationBinding[] annos = searchedElement.getAnnotations();
for (AnnotationBinding annoBinding : annos) {
if (annoBinding.getAnnotationType() == anno) {
// element is annotated with anno
return true;
}
}
} while (null != (searchedElement = searchedElement.superclass()));
return false;
}
示例2: getAnnotationBindings
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
protected AnnotationBinding[] getAnnotationBindings()
{
PackageBinding packageBinding = (PackageBinding) this._binding;
char[][] compoundName = CharOperation.arrayConcat(packageBinding.compoundName, TypeConstants.PACKAGE_INFO_NAME);
ReferenceBinding type = this._env.getLookupEnvironment().getType(compoundName);
AnnotationBinding[] annotations = null;
if (type != null && type.isValidBinding()) {
annotations = type.getAnnotations();
}
return annotations;
}