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

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

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

Flags.isAbstract介绍

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

代码示例

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

public boolean isAbstract() {
  try {
    return Flags.isAbstract(this.getJdtMember().getFlags());
  } catch (JavaModelException ex) {
    throw new RuntimeException(ex);
  }
}

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

private static boolean isTestImplementor(IType type) throws JavaModelException {
    if (!Flags.isAbstract(type.getFlags()) && CoreTestSearchEngine.isTestImplementor(type)) {
      return true;
    }
    return false;
  }
}

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

public static boolean isAbstract(IMember member) throws JavaModelException{
  if (isInterfaceOrAnnotationMethod(member))
    return true;
  return Flags.isAbstract(member.getFlags());	
}

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

private boolean isAbstractClass(IType res) {	
  try {
    if (res.isClass() && Flags.isAbstract(res.getFlags()))
      return true;
  } catch (JavaModelException e) {
    //ignore
  }
  return false;
}

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

private static boolean isTestImplementor(IType type) throws JavaModelException {
    if (!Flags.isAbstract(type.getFlags()) && CoreTestSearchEngine.isTestImplementor(type)) {
      return true;
    }
    return false;
  }
}

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

private boolean isCacheableRHS(IType type) throws JavaModelException {
  return !type.isInterface() && !Flags.isAbstract(type.getFlags());
}

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

private boolean isCacheableRHS(IType type) throws JavaModelException {
  return !type.isInterface() && !Flags.isAbstract(type.getFlags());
}

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

private boolean isCacheableRHS(IType type) throws JavaModelException {
  return !type.isInterface() && !Flags.isAbstract(type.getFlags());
}

代码示例来源: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.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.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: angelozerr/jdt-codemining

public static boolean isMethod(IMethod method, boolean onlyPublicMethod) {
  try {
    int flags = method.getFlags();
    if (onlyPublicMethod && !Flags.isPublic(flags)) {
      return false;
    }
    // 'V' is void signature
    return !(method.isConstructor() || Flags.isAbstract(flags) || Flags.isStatic(flags)
        || !"V".equals(method.getReturnType()));
  } catch (JavaModelException e) {
    // ignore
    return false;
  }
}

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

/**
 * Hook method that gets called when the modifiers have changed. The method validates
 * the modifiers and returns the status of the validation.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 *
 * @return the status of the validation
 */
protected IStatus modifiersChanged() {
  StatusInfo status= new StatusInfo();
  int modifiers= getModifiers();
  if (Flags.isFinal(modifiers) && Flags.isAbstract(modifiers)) {
    status.setError(NewWizardMessages.NewTypeWizardPage_error_ModifiersFinalAndAbstract);
  }
  return status;
}

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

/**
 * Hook method that gets called when the modifiers have changed. The method validates 
 * the modifiers and returns the status of the validation.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 * 
 * @return the status of the validation
 */
protected IStatus modifiersChanged() {
  StatusInfo status= new StatusInfo();
  int modifiers= getModifiers();
  if (Flags.isFinal(modifiers) && Flags.isAbstract(modifiers)) {
    status.setError(NewWizardMessages.NewTypeWizardPage_error_ModifiersFinalAndAbstract); 
  }
  return status;
}

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

/**
 * Hook method that gets called when the modifiers have changed. The method validates
 * the modifiers and returns the status of the validation.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 *
 * @return the status of the validation
 */
protected IStatus modifiersChanged() {
  StatusInfo status= new StatusInfo();
  int modifiers= getModifiers();
  if (Flags.isFinal(modifiers) && Flags.isAbstract(modifiers)) {
    status.setError(NewWizardMessages.NewTypeWizardPage_error_ModifiersFinalAndAbstract);
  }
  return status;
}

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

/**
 * Hook method that gets called when the modifiers have changed. The method validates 
 * the modifiers and returns the status of the validation.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 * 
 * @return the status of the validation
 */
protected IStatus modifiersChanged() {
  StatusInfo status= new StatusInfo();
  int modifiers= getModifiers();
  if (Flags.isFinal(modifiers) && Flags.isAbstract(modifiers)) {
    status.setError(NewWizardMessages.NewTypeWizardPage_error_ModifiersFinalAndAbstract); 
  }
  return status;
}

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

public static boolean isAbstract(IMember member) throws JavaModelException{
  int flags= member.getFlags();
  if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) {
    return !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags);
  }
  return Flags.isAbstract(flags);
}

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

public static boolean isAbstract(IMember member) throws JavaModelException{
  int flags= member.getFlags();
  if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) {
    return !Flags.isPrivate(flags) && !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags);
  }
  return Flags.isAbstract(flags);
}

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

public static boolean isAbstract(IMember member) throws JavaModelException{
  int flags= member.getFlags();
  if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) {
    return !Flags.isPrivate(flags) && !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags);
  }
  return Flags.isAbstract(flags);
}

代码示例来源:origin: Microsoft/vscode-java-test

private static boolean isTestableClass(IType type) throws JavaModelException {
  int flags = type.getFlags();
  if (Flags.isInterface(flags) || Flags.isAbstract(flags)) {
    return false;
  }
  IJavaElement parent = type.getParent();
  while (true) {
    if (parent instanceof ICompilationUnit || parent instanceof IClassFile) {
      return true;
    }
    if (!(parent instanceof IType) || !Flags.isStatic(flags) || !Flags.isPublic(flags)) {
      return false;
    }
    flags = ((IType) parent).getFlags();
    parent = parent.getParent();
  }
}

相关文章