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

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

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

Flags.isPrivate介绍

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

代码示例

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools

/**
   * Determine if the flags contain private or package default flags
   *
   * @param flags
   * @return <code>true</code> if the flags are private or default,
   *         <code>false</code> otherwise
   */
  private boolean isNotVisible(int flags) {
    return Flags.isPrivate(flags) || Flags.isPackageDefault(flags);
  }
}

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

private static ImageDescriptor getClassImageDescriptor(int flags) {
  if (Flags.isPublic(flags) || Flags.isProtected(flags) || Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_CLASS;
  else
    return JavaPluginImages.DESC_OBJS_CLASS_DEFAULT;
}

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

private static ImageDescriptor getInnerClassImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_PUBLIC;
  else if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_PRIVATE;
  else if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_PROTECTED;
  else
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_DEFAULT;
}

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

private static ImageDescriptor getInnerClassImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_PUBLIC;
  else if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_PRIVATE;
  else if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_PROTECTED;
  else
    return JavaPluginImages.DESC_OBJS_INNER_CLASS_DEFAULT;
}

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

private static ImageDescriptor getInnerEnumImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_OBJS_ENUM;
  else if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_ENUM_PRIVATE;
  else if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_OBJS_ENUM_PROTECTED;
  else
    return JavaPluginImages.DESC_OBJS_ENUM_DEFAULT;
}

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

private static ImageDescriptor getInnerAnnotationImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_OBJS_ANNOTATION;
  else if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_ANNOTATION_PRIVATE;
  else if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_OBJS_ANNOTATION_PROTECTED;
  else
    return JavaPluginImages.DESC_OBJS_ANNOTATION_DEFAULT;
}

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

private static ImageDescriptor getInterfaceImageDescriptor(int flags) {
  if (Flags.isPublic(flags) || Flags.isProtected(flags) || Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_INTERFACE;
  else
    return JavaPluginImages.DESC_OBJS_INTERFACE_DEFAULT;
}

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

private static ImageDescriptor getAnnotationImageDescriptor(int flags) {
  if (Flags.isPublic(flags) || Flags.isProtected(flags) || Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_ANNOTATION;
  else
    return JavaPluginImages.DESC_OBJS_ANNOTATION_DEFAULT;
}

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

public static ImageDescriptor getMethodImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags))
    return JavaPluginImages.DESC_MISC_PUBLIC;
  if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_MISC_PROTECTED;
  if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_MISC_PRIVATE;
  if (isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_MISC_PUBLIC;
  return JavaPluginImages.DESC_MISC_DEFAULT;
}

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

private static ImageDescriptor getInnerAnnotationImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_OBJS_ANNOTATION;
  else if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_OBJS_ANNOTATION_PRIVATE;
  else if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_OBJS_ANNOTATION_PROTECTED;
  else
    return JavaPluginImages.DESC_OBJS_ANNOTATION_DEFAULT;
}

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

public static ImageDescriptor getMethodImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_MISC_PUBLIC;
  if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_MISC_PROTECTED;
  if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_MISC_PRIVATE;
  
  return JavaPluginImages.DESC_MISC_DEFAULT;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools

@Override
public boolean visit(AnnotationTypeDeclaration node) {
  isvisible &= !Flags.isPrivate(node.getModifiers());
  fStack.push(new Item(getTypeName(node), node.getModifiers(), isvisible));
  return true;
}

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

private boolean isInnerOrAnonymousClass(IType res) {
  try {
    if (res.isClass() && (res.isAnonymous() || 
                (Flags.isPrivate(res.getFlags())) || 
                res.getFullyQualifiedName().indexOf("$") > 0)) //must be better way to discover if it is an inner class //$NON-NLS-1$
      return true;
  } catch (JavaModelException e) {
    //ignore
  }
  return false;
}

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

public static ImageDescriptor getFieldImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation || Flags.isEnum(flags))
    return JavaPluginImages.DESC_FIELD_PUBLIC;
  if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_FIELD_PROTECTED;
  if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_FIELD_PRIVATE;
  return JavaPluginImages.DESC_FIELD_DEFAULT;
}

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

public static ImageDescriptor getFieldImageDescriptor(boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation || Flags.isEnum(flags))
    return JavaPluginImages.DESC_FIELD_PUBLIC;
  if (Flags.isProtected(flags))
    return JavaPluginImages.DESC_FIELD_PROTECTED;
  if (Flags.isPrivate(flags))
    return JavaPluginImages.DESC_FIELD_PRIVATE;
    
  return JavaPluginImages.DESC_FIELD_DEFAULT;
}

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

private boolean isVisible(TypeNameMatch curr, ICompilationUnit cu) {
  int flags= curr.getModifiers();
  if (Flags.isPrivate(flags)) {
    return false;
  }
  if (Flags.isPublic(flags) || Flags.isProtected(flags)) {
    return true;
  }
  return curr.getPackageName().equals(cu.getParent().getElementName());
}

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

private boolean isVisible(TypeNameMatch curr) {
  int flags= curr.getModifiers();
  if (Flags.isPrivate(flags)) {
    return false;
  }
  if (Flags.isPublic(flags) || Flags.isProtected(flags)) {
    return true;
  }
  return curr.getPackageName().equals(fCompilationUnit.getParent().getElementName());
}

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

private boolean isVisible(TypeNameMatch curr, ICompilationUnit cu) {
  int flags= curr.getModifiers();
  if (Flags.isPrivate(flags)) {
    return false;
  }
  if (Flags.isPublic(flags) || Flags.isProtected(flags)) {
    return true;
  }
  return curr.getPackageName().equals(cu.getParent().getElementName());
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools

@Override
public boolean visit(EnumDeclaration node) {
  int flags = node.getModifiers();
  if (node.isMemberTypeDeclaration()) {
    isvisible &= Flags.isPublic(flags);
  } else {
    isvisible &= !Flags.isPrivate(flags) && !Flags.isPackageDefault(flags);
  }
  fStack.push(new Item(getTypeName(node), node.getModifiers(), isvisible));
  return true;
}

代码示例来源: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);
}

相关文章