本文整理汇总了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);
}
}
示例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);
}
}
示例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());
}
示例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));
}
示例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));
}
示例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;
}
示例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);
}
}
示例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 "";
}
示例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;
}
示例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];
}
示例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());
}
示例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;
}
示例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()]);
}
示例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;
}
示例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;
}