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


Java Flags.isPrivate方法代码示例

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


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

示例1: handleType

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void handleType(IType type, IFile file, List<ServiceImplementation> serviceImplementations) throws JavaModelException {
	/* Parcourt les méthodes. */
	for (IMethod method : type.getMethods()) {
		/* Filtre pour ne garder que les méthodes publiques d'instance */
		if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
			continue;
		}

		/* Créé le ServiceImplementation. */
		String javaName = method.getElementName();
		ISourceRange nameRange = method.getNameRange();
		FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
		ServiceImplementation serviceImplementation = new ServiceImplementation(fileRegion, javaName);
		serviceImplementations.add(serviceImplementation);
	}
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:17,代码来源:ServiceManager.java

示例2: handleType

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void handleType(IType type, IFile file, List<DaoImplementation> daoImplementations) throws JavaModelException {
	/* Parcourt les méthodes. */
	for (IMethod method : type.getMethods()) {
		/* Filtre pour ne garder que les méthodes publiques d'instance */
		if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
			continue;
		}

		/* Créé le DaoImplementation. */
		String javaName = method.getElementName();
		ISourceRange nameRange = method.getNameRange();
		FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
		DaoImplementation daoImplementation = new DaoImplementation(fileRegion, javaName);
		daoImplementations.add(daoImplementation);
	}
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:17,代码来源:DaoManager.java

示例3: isVisible

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private boolean isVisible(TypeNameMatch curr) {
	int flags= curr.getModifiers();
	if (Flags.isPrivate(flags)) {
		return false;
	}
	boolean isPublic;
	try {
		isPublic= JdtFlags.isPublic(curr.getType());
	} catch (JavaModelException e) {
		isPublic= Flags.isPublic(flags);
	}
	if (isPublic || Flags.isProtected(flags)) {
		return true;
	}
	return curr.getPackageName().equals(fCurrPackage.getElementName());
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:OrganizeImportsOperation.java

示例4: isVisibleInHierarchy

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Evaluates if a member in the focus' element hierarchy is visible from elements in a package.
 *
 * @param member The member to test the visibility for
 * @param pack The package of the focus element focus
 * @return returns <code>true</code> if the member is visible from the package
 * @throws JavaModelException thrown when the member can not be accessed
 */
public static boolean isVisibleInHierarchy(IMember member, IPackageFragment pack)
    throws JavaModelException {
  int type = member.getElementType();
  if (type == IJavaElement.INITIALIZER
      || (type == IJavaElement.METHOD
          && member.getElementName().startsWith("<"))) { // $NON-NLS-1$
    return false;
  }

  int otherflags = member.getFlags();

  IType declaringType = member.getDeclaringType();
  if (Flags.isPublic(otherflags)
      || Flags.isProtected(otherflags)
      || (declaringType != null && isInterfaceOrAnnotation(declaringType))) {
    return true;
  } else if (Flags.isPrivate(otherflags)) {
    return false;
  }

  IPackageFragment otherpack =
      (IPackageFragment) member.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
  return (pack != null && pack.equals(otherpack));
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:JavaModelUtil.java

示例5: isVisible

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Evaluates if a member (possible from another package) is visible from elements in a package.
 *
 * @param member The member to test the visibility for
 * @param pack The package in focus
 * @return returns <code>true</code> if the member is visible from the package
 * @throws JavaModelException thrown when the member can not be accessed
 */
public static boolean isVisible(IMember member, IPackageFragment pack) throws JavaModelException {

  int type = member.getElementType();
  if (type == IJavaElement.INITIALIZER
      || (type == IJavaElement.METHOD
          && member.getElementName().startsWith("<"))) { // $NON-NLS-1$
    return false;
  }

  int otherflags = member.getFlags();
  IType declaringType = member.getDeclaringType();
  if (Flags.isPublic(otherflags)
      || (declaringType != null && isInterfaceOrAnnotation(declaringType))) {
    return true;
  } else if (Flags.isPrivate(otherflags)) {
    return false;
  }

  IPackageFragment otherpack =
      (IPackageFragment) member.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
  return (pack != null && otherpack != null && isSamePackage(pack, otherpack));
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:JavaModelUtil.java

示例6: findOverridingMethodInType

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Finds an overriding method in a type.
 *
 * @param overridingType The type to find methods in
 * @param overridden The overridden method
 * @return The overriding method or <code>null</code> if no method is overriding.
 * @throws JavaModelException if a problem occurs
 */
public IMethod findOverridingMethodInType(IType overridingType, IMethod overridden)
    throws JavaModelException {
  int flags = overridden.getFlags();
  if (Flags.isPrivate(flags) || Flags.isStatic(flags) || overridden.isConstructor()) return null;
  IMethod[] overridingMethods = overridingType.getMethods();
  for (int i = 0; i < overridingMethods.length; i++) {
    IMethod overriding = overridingMethods[i];
    flags = overriding.getFlags();
    if (Flags.isPrivate(flags) || Flags.isStatic(flags) || overriding.isConstructor()) continue;
    if (isSubsignature(overriding, overridden)) {
      return overriding;
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:MethodOverrideTester.java

示例7: handleMethod

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void handleMethod(IMethod method, String pathPrefix, IFile file, List<WsRoute> wsRoutes) throws JavaModelException {
	/* Filtre pour ne garder que les méthodes publiques d'instance */
	if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
		return;
	}

	/* Parcourt les verbes HTTP */
	for (String verb : HTTP_VERBS) {

		/* Extrait l'annotation du verbe. */
		IAnnotation verbAnnotation = JdtUtils.getAnnotation(method, verb);
		if (verbAnnotation == null) {
			continue;
		}

		/* Extrait la route partielle. */
		String routePatternSuffix = JdtUtils.getMemberValue(verbAnnotation);

		/* Calcule la route complète. */
		String routePattern = pathPrefix + routePatternSuffix;

		/* Créé la WsRoute. */
		String javaName = method.getElementName();
		ISourceRange nameRange = method.getNameRange();
		FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
		WsRoute wsRoute = new WsRoute(fileRegion, javaName, routePattern, verb);
		wsRoutes.add(wsRoute);
	}
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:30,代码来源:WsRouteManager.java

示例8: getModifier

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private String getModifier(int modifiers) {
	if (Flags.isPublic(modifiers) && Flags.isStatic(modifiers) && Flags.isFinal(modifiers))
		return "constant ";
	if (Flags.isPublic(modifiers))
		return "public ";
	if (Flags.isPrivate(modifiers))
		return "private ";
	if (Flags.isProtected(modifiers))
		return "protected ";
	return "";
}
 
开发者ID:ioanaverebi,项目名称:Sparrow,代码行数:12,代码来源:ModelVisitor.java

示例9: getConsistentlyVisibleSets

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public static Collection getConsistentlyVisibleSets(Collection elementSets)
		throws JavaModelException {
	final Collection ret = new LinkedHashSet(elementSets);
	for (final Iterator it = elementSets.iterator(); it.hasNext();) {
		final Collection set = (Collection) it.next();

		boolean allPublic = true;
		boolean allPrivate = true;
		boolean allPackage = true;
		boolean allProtected = true;

		for (final Iterator jit = set.iterator(); jit.hasNext();) {
			final IJavaElement elem = (IJavaElement) jit.next();
			if (elem.getElementType() == IJavaElement.FIELD) {
				final IField field = (IField) elem;
				final Object constValue = field.getConstant();
				if (constValue != null) {
					allPublic &= Flags.isPublic(field.getFlags());
					allPrivate &= Flags.isPrivate(field.getFlags());
					allProtected &= Flags.isProtected(field.getFlags());
					allPackage &= Flags.isPackageDefault(field.getFlags());
				}
			}
		}
		if (!(allPublic || allPrivate || allPackage || allProtected))
			ret.remove(set);
	}
	return ret;
}
 
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:30,代码来源:Util.java

示例10: getVisibilityIndex

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public int getVisibilityIndex(int modifierFlags) {
  if (fVisibilityOffsets == null) {
    fVisibilityOffsets = getVisibilityOffsets();
  }
  int kind = DEFAULT_INDEX;
  if (Flags.isPublic(modifierFlags)) {
    kind = PUBLIC_INDEX;
  } else if (Flags.isProtected(modifierFlags)) {
    kind = PROTECTED_INDEX;
  } else if (Flags.isPrivate(modifierFlags)) {
    kind = PRIVATE_INDEX;
  }

  return fVisibilityOffsets[kind];
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:MembersOrderPreferenceCache.java

示例11: isVisible

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
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());
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:JavaContext.java

示例12: getInnerInterfaceImageDescriptor

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static ImageDescriptor getInnerInterfaceImageDescriptor(
    boolean isInInterfaceOrAnnotation, int flags) {
  if (Flags.isPublic(flags) || isInInterfaceOrAnnotation)
    return JavaPluginImages.DESC_OBJS_INNER_INTERFACE_PUBLIC;
  else if (Flags.isPrivate(flags)) return JavaPluginImages.DESC_OBJS_INNER_INTERFACE_PRIVATE;
  else if (Flags.isProtected(flags)) return JavaPluginImages.DESC_OBJS_INNER_INTERFACE_PROTECTED;
  else return JavaPluginImages.DESC_OBJS_INTERFACE_DEFAULT;
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:JavaElementImageProvider.java

示例13: getNonStaticNonCacheFieldsAndAccessibleNonStaticFieldsOfSuperclasses

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private IField[] getNonStaticNonCacheFieldsAndAccessibleNonStaticFieldsOfSuperclasses(IType objectClass,
        PreferencesManager preferencesManager) throws JavaModelException {
    List<IField> result = new ArrayList<>();

    ITypeHierarchy typeHierarchy = objectClass.newSupertypeHierarchy(null);
    IType[] superclasses = typeHierarchy.getAllSuperclasses(objectClass);

    for (int i = 0; i < superclasses.length; i++) {
        IField[] fields = superclasses[i].getFields();

        boolean samePackage = objectClass.getPackageFragment().getElementName()
                .equals(superclasses[i].getPackageFragment().getElementName());

        for (int j = 0; j < fields.length; j++) {

            if (!samePackage && !Flags.isPublic(fields[j].getFlags()) && !Flags.isProtected(fields[j].getFlags())) {
                continue;
            }

            if (!Flags.isPrivate(fields[j].getFlags()) && !Flags.isStatic(fields[j].getFlags())) {
                result.add(fields[j]);
            }
        }
    }

    result.addAll(Arrays.asList(getNonStaticNonCacheFields(objectClass, preferencesManager)));

    return result.toArray(new IField[result.size()]);
}
 
开发者ID:maximeAudrain,项目名称:jenerate,代码行数:30,代码来源:DialogFactoryHelperImpl.java

示例14: getDescriptorFlags

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
protected int getDescriptorFlags() {
  int flags =
      JavaRefactoringDescriptor.JAR_MIGRATION
          | JavaRefactoringDescriptor.JAR_REFACTORING
          | RefactoringDescriptor.STRUCTURAL_CHANGE;
  try {
    if (!Flags.isPrivate(fMethod.getFlags())) flags |= RefactoringDescriptor.MULTI_CHANGE;
    final IType declaring = fMethod.getDeclaringType();
    if (declaring.isAnonymous() || declaring.isLocal())
      flags |= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
  } catch (JavaModelException exception) {
    JavaPlugin.log(exception);
  }
  return flags;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:ChangeSignatureProcessor.java

示例15: getMethodImageDescriptor

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:JavaElementImageProvider.java


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