本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.isAnnotationType方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.isAnnotationType方法的具体用法?Java ReferenceBinding.isAnnotationType怎么用?Java ReferenceBinding.isAnnotationType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
的用法示例。
在下文中一共展示了ReferenceBinding.isAnnotationType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAnnotationMirror
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private AnnotationMirrorImpl createAnnotationMirror(String annoTypeName, AnnotationBinding annoInstance) {
ReferenceBinding binding = annoInstance.getAnnotationType();
if (binding != null && binding.isAnnotationType() ) {
char[] qName;
if (binding.isMemberType()) {
annoTypeName = annoTypeName.replace('$', '.');
qName = CharOperation.concatWith(binding.enclosingType().compoundName, binding.sourceName, '.');
CharOperation.replace(qName, '$', '.');
} else {
qName = CharOperation.concatWith(binding.compoundName, '.');
}
if(annoTypeName.equals(new String(qName)) ){
return (AnnotationMirrorImpl)_env.getFactory().newAnnotationMirror(annoInstance);
}
}
return null;
}
示例2: getKind
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public ElementKind getKind() {
if (null != _kindHint) {
return _kindHint;
}
ReferenceBinding refBinding = (ReferenceBinding)_binding;
// The order of these comparisons is important: e.g., enum is subset of class
if (refBinding.isEnum()) {
return ElementKind.ENUM;
}
else if (refBinding.isAnnotationType()) {
return ElementKind.ANNOTATION_TYPE;
}
else if (refBinding.isInterface()) {
return ElementKind.INTERFACE;
}
else if (refBinding.isClass()) {
return ElementKind.CLASS;
}
else {
throw new IllegalArgumentException("TypeElement " + new String(refBinding.shortReadableName()) + //$NON-NLS-1$
" has unexpected attributes " + refBinding.modifiers); //$NON-NLS-1$
}
}
示例3: newProxyInstance
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // for cast of newProxyInstance() to A
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
AnnotationBinding[] annoInstances = getAnnotationBindings();
if( annoInstances == null || annoInstances.length == 0 || annotationClass == null )
return null;
String annoTypeName = annotationClass.getName();
if( annoTypeName == null ) return null;
annoTypeName = annoTypeName.replace('$', '.');
for( AnnotationBinding annoInstance : annoInstances) {
if (annoInstance == null)
continue;
ReferenceBinding binding = annoInstance.getAnnotationType();
if ( binding != null && binding.isAnnotationType() ) {
char[] qName;
if (binding.isMemberType()) {
qName = CharOperation.concatWith(binding.enclosingType().compoundName, binding.sourceName, '.');
CharOperation.replace(qName, '$', '.');
} else {
qName = CharOperation.concatWith(binding.compoundName, '.');
}
if( annoTypeName.equals(new String(qName)) ){
AnnotationMirrorImpl annoMirror =
(AnnotationMirrorImpl)_env.getFactory().newAnnotationMirror(annoInstance);
return (A)Proxy.newProxyInstance(annotationClass.getClassLoader(),
new Class[]{ annotationClass }, annoMirror );
}
}
}
return null;
}