org.eclipse.jdt.core.Flags.isInterface()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.eclipse.jdt.core.Flags.isInterface()方法的一些代码示例,展示了Flags.isInterface()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flags.isInterface()方法的具体详情如下:
包路径:org.eclipse.jdt.core.Flags
类名称:Flags
方法名:isInterface

Flags.isInterface介绍

[英]Returns whether the given integer includes the interface modifier.
[中]返回给定整数是否包含interface修饰符。

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
  public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) {
    if (Flags.isInterface(modifiers)) {
      this.nameRequestor.acceptInterface(packageName, simpleTypeName, enclosingTypeNames, path);
    } else {
      this.nameRequestor.acceptClass(packageName, simpleTypeName, enclosingTypeNames, path);
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) {
    if (Flags.isInterface(modifiers)) {
      this.nameRequestor.acceptInterface(packageName, simpleTypeName, enclosingTypeNames, path);
    } else {
      this.nameRequestor.acceptClass(packageName, simpleTypeName, enclosingTypeNames, path);
    }
  }
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) {
    if (Flags.isInterface(modifiers)) {
      this.nameRequestor.acceptInterface(packageName, simpleTypeName, enclosingTypeNames, path);
    } else {
      this.nameRequestor.acceptClass(packageName, simpleTypeName, enclosingTypeNames, path);
    }
  }
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) {
    if (Flags.isInterface(modifiers)) {
      this.nameRequestor.acceptInterface(packageName, simpleTypeName, enclosingTypeNames, path);
    } else {
      this.nameRequestor.acceptClass(packageName, simpleTypeName, enclosingTypeNames, path);
    }
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private boolean isInterface(IType type) {
  int flags = getCachedFlags(type);
  if (flags == -1) {
    try {
      return type.isInterface();
    } catch (JavaModelException e) {
      return false;
    }
  } else {
    return Flags.isInterface(flags);
  }
}
/**

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) {
    if (Flags.isInterface(modifiers)) {
      this.nameRequestor.acceptInterface(packageName, simpleTypeName, enclosingTypeNames, path);
    } else {
      this.nameRequestor.acceptClass(packageName, simpleTypeName, enclosingTypeNames, path);
    }
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private boolean isInterface(IType type) {
  int flags = getCachedFlags(type);
  if (flags == -1) {
    try {
      return type.isInterface();
    } catch (JavaModelException e) {
      return false;
    }
  } else {
    return Flags.isInterface(flags);
  }
}
/**

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private boolean isInterface(IType type) {
  int flags = getCachedFlags(type);
  if (flags == -1) {
    try {
      return type.isInterface();
    } catch (JavaModelException e) {
      return false;
    }
  } else {
    return Flags.isInterface(flags);
  }
}
/**

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private ImageDescriptor getOverlayFromFlags(int flags)  {
  if (Flags.isAnnotation(flags)) {
    return JavaPluginImages.DESC_OVR_ANNOTATION;
  } else if (Flags.isEnum(flags)) {
    return JavaPluginImages.DESC_OVR_ENUM;
  } else if (Flags.isInterface(flags)) {
    return JavaPluginImages.DESC_OVR_INTERFACE;
  } else if (/* is class */ Flags.isAbstract(flags)) {
    return JavaPluginImages.DESC_OVR_ABSTRACT_CLASS;
  }
  return null;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
  int flags= curr.getModifiers();
  if (Flags.isAnnotation(flags)) {
    return is50OrHigher && (typeKinds & TypeKinds.ANNOTATIONS) != 0;
  }
  if (Flags.isEnum(flags)) {
    return is50OrHigher && (typeKinds & TypeKinds.ENUMS) != 0;
  }
  if (Flags.isInterface(flags)) {
    return (typeKinds & TypeKinds.INTERFACES) != 0;
  }
  return (typeKinds & TypeKinds.CLASSES) != 0;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
  int flags= curr.getModifiers();
  if (Flags.isAnnotation(flags)) {
    return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0);
  }
  if (Flags.isEnum(flags)) {
    return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ENUMS) != 0);
  }
  if (Flags.isInterface(flags)) {
    return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
  }
  return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}

代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
  int flags= curr.getModifiers();
  if (Flags.isAnnotation(flags)) {
    return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0);
  }
  if (Flags.isEnum(flags)) {
    return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ENUMS) != 0);
  }
  if (Flags.isInterface(flags)) {
    return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
  }
  return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
  int flags= curr.getModifiers();
  if (Flags.isAnnotation(flags)) {
    return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0);
  }
  if (Flags.isEnum(flags)) {
    return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ENUMS) != 0);
  }
  if (Flags.isInterface(flags)) {
    return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
  }
  return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
  int flags= curr.getModifiers();
  if (Flags.isAnnotation(flags)) {
    return is50OrHigher && (typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0;
  }
  if (Flags.isEnum(flags)) {
    return is50OrHigher && (typeKinds & SimilarElementsRequestor.ENUMS) != 0;
  }
  if (Flags.isInterface(flags)) {
    return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
  }
  return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
  int flags= curr.getModifiers();
  if (Flags.isAnnotation(flags)) {
    return is50OrHigher && (typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0;
  }
  if (Flags.isEnum(flags)) {
    return is50OrHigher && (typeKinds & SimilarElementsRequestor.ENUMS) != 0;
  }
  if (Flags.isInterface(flags)) {
    return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
  }
  return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}

代码示例来源:origin: org.eclipse.jdt.junit/core

public static void findTestImplementorClasses(ITypeHierarchy typeHierarchy, IType testInterface, IRegion region, Set result)
    throws JavaModelException {
  IType[] subtypes= typeHierarchy.getAllSubtypes(testInterface);
  for (int i= 0; i < subtypes.length; i++) {
    IType type= subtypes[i];
    int cachedFlags= typeHierarchy.getCachedFlags(type);
    if (!Flags.isInterface(cachedFlags) && !Flags.isAbstract(cachedFlags) // do the cheaper tests first
        && region.contains(type) && CoreTestSearchEngine.isAccessibleClass(type)) {
      result.add(type);
    }
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.junit.core

public static void findTestImplementorClasses(ITypeHierarchy typeHierarchy, IType testInterface, IRegion region, Set<IType> result)
    throws JavaModelException {
  IType[] subtypes= typeHierarchy.getAllSubtypes(testInterface);
  for (int i= 0; i < subtypes.length; i++) {
    IType type= subtypes[i];
    int cachedFlags= typeHierarchy.getCachedFlags(type);
    if (!Flags.isInterface(cachedFlags) && !Flags.isAbstract(cachedFlags) // do the cheaper tests first
        && region.contains(type) && CoreTestSearchEngine.isAccessibleClass(type)) {
      result.add(type);
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) {
  final int flags= proposal.getFlags();
  boolean isInterfaceOrAnnotation= Flags.isInterface(flags) || Flags.isAnnotation(flags);
  return decorateImageDescriptor(JavaElementImageProvider.getTypeImageDescriptor(true /* in order to get all visibility decorations */, isInterfaceOrAnnotation, flags, false), proposal);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) {
  final int flags= proposal.getFlags();
  boolean isInterfaceOrAnnotation= Flags.isInterface(flags) || Flags.isAnnotation(flags);
  return decorateImageDescriptor(JavaElementImageProvider.getTypeImageDescriptor(true /* in order to get all visibility decorations */, isInterfaceOrAnnotation, flags, false), proposal);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) {
  final int flags= proposal.getFlags();
  boolean isInterfaceOrAnnotation= Flags.isInterface(flags) || Flags.isAnnotation(flags);
  return decorateImageDescriptor(JavaElementImageProvider.getTypeImageDescriptor(true /* in order to get all visibility decorations */, isInterfaceOrAnnotation, flags, false), proposal);
}

相关文章