本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.isInterface方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.isInterface方法的具体用法?Java ReferenceBinding.isInterface怎么用?Java ReferenceBinding.isInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
的用法示例。
在下文中一共展示了ReferenceBinding.isInterface方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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$
}
}
示例2: getModifiers
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public Set<Modifier> getModifiers()
{
ReferenceBinding refBinding = (ReferenceBinding)_binding;
int modifiers = refBinding.modifiers;
if (refBinding.isInterface() && refBinding.isNestedType()) {
modifiers |= ClassFileConstants.AccStatic;
}
return Factory.getModifiers(modifiers, getKind(), refBinding.isBinaryBinding());
}
示例3: getSuperclass
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public TypeMirror getSuperclass() {
ReferenceBinding binding = (ReferenceBinding)_binding;
ReferenceBinding superBinding = binding.superclass();
if (null == superBinding || binding.isInterface()) {
return _env.getFactory().getNoType(TypeKind.NONE);
}
// superclass of a type must be a DeclaredType
return _env.getFactory().newTypeMirror(superBinding);
}
示例4: findExactMethod
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, null);
if (exactMethod != null){
if (receiverType.isInterface() || canBeSeenByForCodeSnippet(exactMethod, receiverType, invocationSite, this))
return exactMethod;
}
return null;
}
示例5: getAllInheritedMethods0
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList<MethodBinding> collector) {
if (!binding.isInterface()) return;
MethodBinding[] methodBindings = binding.methods();
for (int i = 0, max = methodBindings.length; i < max; i++) {
collector.add(methodBindings[i]);
}
ReferenceBinding[] superInterfaces = binding.superInterfaces();
for (int i = 0, max = superInterfaces.length; i < max; i++) {
getAllInheritedMethods0(superInterfaces[i], collector);
}
}
示例6: getAllInheritedMethods0
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList collector) {
if (!binding.isInterface()) return;
MethodBinding[] methodBindings = binding.methods();
for (int i = 0, max = methodBindings.length; i < max; i++) {
collector.add(methodBindings[i]);
}
ReferenceBinding[] superInterfaces = binding.superInterfaces();
for (int i = 0, max = superInterfaces.length; i < max; i++) {
getAllInheritedMethods0(superInterfaces[i], collector);
}
}
示例7: searchVisibleMethods
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void searchVisibleMethods(
ReferenceBinding receiverType,
Scope scope,
InvocationSite invocationSite,
Scope invocationScope,
boolean onlyStaticMethods,
boolean notInJavadoc,
ObjectVector methodsFound) {
ReferenceBinding currentType = receiverType;
if (notInJavadoc) {
if (receiverType.isInterface()) {
searchVisibleInterfaceMethods(
new ReferenceBinding[]{currentType},
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
currentType = scope.getJavaLangObject();
}
}
boolean hasPotentialDefaultAbstractMethods = true;
while (currentType != null) {
MethodBinding[] methods = currentType.availableMethods();
if (methods != null) {
searchVisibleLocalMethods(
methods,
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
}
if (notInJavadoc &&
hasPotentialDefaultAbstractMethods &&
(currentType.isAbstract() ||
currentType.isTypeVariable() ||
currentType.isIntersectionType() ||
currentType.isEnum())){
ReferenceBinding[] superInterfaces = currentType.superInterfaces();
if (superInterfaces != null && currentType.isIntersectionType()) {
for (int i = 0; i < superInterfaces.length; i++) {
superInterfaces[i] = (ReferenceBinding)superInterfaces[i].capture(invocationScope, invocationSite.sourceEnd());
}
}
searchVisibleInterfaceMethods(
superInterfaces,
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
} else {
hasPotentialDefaultAbstractMethods = false;
}
if(currentType.isParameterizedType()) {
currentType = ((ParameterizedTypeBinding)currentType).genericType().superclass();
} else {
currentType = currentType.superclass();
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:71,代码来源:InternalExtendedCompletionContext.java
示例8: generateInnerClassAttribute
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private int generateInnerClassAttribute(int numberOfInnerClasses, ReferenceBinding[] innerClasses) {
int localContentsOffset = this.contentsOffset;
// Generate the inner class attribute
int exSize = 8 * numberOfInnerClasses + 8;
if (exSize + localContentsOffset >= this.contents.length) {
resizeContents(exSize);
}
// Now we now the size of the attribute and the number of entries
// attribute name
int attributeNameIndex =
this.constantPool.literalIndex(AttributeNamesConstants.InnerClassName);
this.contents[localContentsOffset++] = (byte) (attributeNameIndex >> 8);
this.contents[localContentsOffset++] = (byte) attributeNameIndex;
int value = (numberOfInnerClasses << 3) + 2;
this.contents[localContentsOffset++] = (byte) (value >> 24);
this.contents[localContentsOffset++] = (byte) (value >> 16);
this.contents[localContentsOffset++] = (byte) (value >> 8);
this.contents[localContentsOffset++] = (byte) value;
this.contents[localContentsOffset++] = (byte) (numberOfInnerClasses >> 8);
this.contents[localContentsOffset++] = (byte) numberOfInnerClasses;
for (int i = 0; i < numberOfInnerClasses; i++) {
ReferenceBinding innerClass = innerClasses[i];
int accessFlags = innerClass.getAccessFlags();
int innerClassIndex = this.constantPool.literalIndexForType(innerClass.constantPoolName());
// inner class index
this.contents[localContentsOffset++] = (byte) (innerClassIndex >> 8);
this.contents[localContentsOffset++] = (byte) innerClassIndex;
// outer class index: anonymous and local have no outer class index
if (innerClass.isMemberType()) {
// member or member of local
int outerClassIndex = this.constantPool.literalIndexForType(innerClass.enclosingType().constantPoolName());
this.contents[localContentsOffset++] = (byte) (outerClassIndex >> 8);
this.contents[localContentsOffset++] = (byte) outerClassIndex;
} else {
// equals to 0 if the innerClass is not a member type
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = 0;
}
// name index
if (!innerClass.isAnonymousType()) {
int nameIndex = this.constantPool.literalIndex(innerClass.sourceName());
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
} else {
// equals to 0 if the innerClass is an anonymous type
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = 0;
}
// access flag
if (innerClass.isAnonymousType()) {
accessFlags &= ~ClassFileConstants.AccFinal;
} else if (innerClass.isMemberType() && innerClass.isInterface()) {
accessFlags |= ClassFileConstants.AccStatic; // implicitely static
}
this.contents[localContentsOffset++] = (byte) (accessFlags >> 8);
this.contents[localContentsOffset++] = (byte) accessFlags;
}
this.contentsOffset = localContentsOffset;
return 1;
}