当前位置: 首页>>代码示例>>Java>>正文


Java Flags.AccPrivate方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.Flags.AccPrivate方法的典型用法代码示例。如果您正苦于以下问题:Java Flags.AccPrivate方法的具体用法?Java Flags.AccPrivate怎么用?Java Flags.AccPrivate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.Flags的用法示例。


在下文中一共展示了Flags.AccPrivate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConsistentVisibility

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public static int getConsistentVisibility(Collection col)
		throws JavaModelException {
	if (col.isEmpty())
		return -1;

	// They should already be consistent.
	final IMember firstElem = (IMember) col.iterator().next();
	if (Flags.isPublic(firstElem.getFlags()))
		return Flags.AccPublic;
	else if (Flags.isPackageDefault(firstElem.getFlags()))
		return Flags.AccDefault;
	else if (Flags.isPrivate(firstElem.getFlags()))
		return Flags.AccPrivate;
	else if (Flags.isProtected(firstElem.getFlags()))
		return Flags.AccProtected;
	else
		throw new IllegalArgumentException(
				Messages.Util_InvalidMemberVisibility);
}
 
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:20,代码来源:Util.java

示例2: appendFlags

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
protected void appendFlags(final IMember member) throws JavaModelException {
  if (member instanceof IAnnotatable)
    for (IAnnotation annotation : ((IAnnotatable) member).getAnnotations()) {
      appendAnnotation(annotation);
    }

  int flags = member.getFlags();
  final int kind = member.getElementType();
  if (kind == IJavaElement.TYPE) {
    flags &= ~Flags.AccSuper;
    final IType type = (IType) member;
    if (!type.isMember()) flags &= ~Flags.AccPrivate;
    if (Flags.isEnum(flags)) flags &= ~Flags.AccAbstract;
  }
  if (Flags.isEnum(flags)) flags &= ~Flags.AccFinal;
  if (kind == IJavaElement.METHOD) {
    flags &= ~Flags.AccVarargs;
    flags &= ~Flags.AccBridge;
  }
  if (flags != 0) fBuffer.append(Flags.toString(flags));
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:StubCreator.java

示例3: checkInitialConditions

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  if (fVisibility < 0)
    fVisibility = (fField.getFlags() & (Flags.AccPublic | Flags.AccProtected | Flags.AccPrivate));
  RefactoringStatus result = new RefactoringStatus();
  result.merge(Checks.checkAvailability(fField));
  if (result.hasFatalError()) return result;
  fRoot =
      new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL)
          .parse(fField.getCompilationUnit(), true, pm);
  ISourceRange sourceRange = fField.getNameRange();
  ASTNode node = NodeFinder.perform(fRoot, sourceRange.getOffset(), sourceRange.getLength());
  if (node == null) {
    return mappingErrorFound(result, node);
  }
  fFieldDeclaration =
      (VariableDeclarationFragment) ASTNodes.getParent(node, VariableDeclarationFragment.class);
  if (fFieldDeclaration == null) {
    return mappingErrorFound(result, node);
  }
  if (fFieldDeclaration.resolveBinding() == null) {
    if (!processCompilerError(result, node))
      result.addFatalError(RefactoringCoreMessages.SelfEncapsulateField_type_not_resolveable);
    return result;
  }
  computeUsedNames();
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:SelfEncapsulateFieldRefactoring.java

示例4: keywordToVisibility

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Converts a given modifier keyword into a visibility flag.
 *
 * @param keyword the keyword to convert
 * @return the visibility flag
 */
private static int keywordToVisibility(final ModifierKeyword keyword) {
  int visibility = 0;
  if (keyword == ModifierKeyword.PUBLIC_KEYWORD) visibility = Flags.AccPublic;
  else if (keyword == ModifierKeyword.PRIVATE_KEYWORD) visibility = Flags.AccPrivate;
  else if (keyword == ModifierKeyword.PROTECTED_KEYWORD) visibility = Flags.AccProtected;
  return visibility;
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:MemberVisibilityAdjustor.java


注:本文中的org.eclipse.jdt.core.Flags.AccPrivate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。