本文整理汇总了Java中org.eclipse.jdt.core.Flags.isStatic方法的典型用法代码示例。如果您正苦于以下问题:Java Flags.isStatic方法的具体用法?Java Flags.isStatic怎么用?Java Flags.isStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.Flags
的用法示例。
在下文中一共展示了Flags.isStatic方法的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: getInstanceMethods
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public List<IMethod> getInstanceMethods() {
if(jType == null)
return Collections.emptyList();
try {
List<IMethod> list = new ArrayList<>();
IMethod[] methods = jType.getMethods();
for(IMethod m : methods)
if(!m.isConstructor() && !Flags.isStatic(m.getFlags()) && isMethodVisible(m))
list.add(m);
return list;
} catch (JavaModelException e) {
e.printStackTrace();
return Collections.emptyList();
}
// return info.getMethods(EnumSet.of(VisibilityInfo.PUBLIC));
}
示例4: addRefCombovalues
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void addRefCombovalues(Combo combo, String paramType) {
if(!PrimitiveType.isPrimitiveSig(paramType)) {
combo.add("null");
IType owner = (IType) method.getParent();
try {
IField[] fields = owner.getFields();
for(IField f : fields)
if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
combo.add(f.getElementName());
} catch (JavaModelException e1) {
e1.printStackTrace();
}
}
}
示例5: addCombovalues
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void addCombovalues(Combo combo, String paramType) {
if(!PrimitiveType.isPrimitiveSig(paramType)) {
String sel = combo.getText();
combo.removeAll();
combo.add("null");
IType owner = (IType) method.getParent();
try {
IField[] fields = owner.getFields();
for(IField f : fields)
if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
combo.add(f.getElementName());
} catch (JavaModelException e1) {
e1.printStackTrace();
}
if(sel.isEmpty())
combo.select(0);
else
combo.setText(sel);
}
}
示例6: isTestMethod
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
@Override
public boolean isTestMethod(IMethod method, ICompilationUnit compilationUnit) {
try {
int flags = method.getFlags();
// 'V' is void signature
return !(method.isConstructor()
|| !Flags.isPublic(flags)
|| Flags.isAbstract(flags)
|| Flags.isStatic(flags)
|| !"V".equals(method.getReturnType()))
&& javaTestFinder.isTest(
method, compilationUnit, JavaTestAnnotations.JUNIT4X_TEST.getName());
} catch (JavaModelException ignored) {
return false;
}
}
示例7: isAccessibleClass
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static boolean isAccessibleClass(IType type) throws JavaModelException {
int flags = type.getFlags();
if (Flags.isInterface(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();
}
}
示例8: 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;
}
示例9: getNewMethodSignature
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public String getNewMethodSignature() throws JavaModelException {
StringBuffer buff = new StringBuffer();
buff.append(getVisibilityString(fVisibility));
int flags = getMethod().getFlags();
if (Flags.isStatic(flags)) {
buff.append("static "); // $NON-NLS-1$
} else if (Flags.isDefaultMethod(flags)) {
buff.append("default "); // $NON-NLS-1$
}
if (!getMethod().isConstructor()) buff.append(getReturnTypeString()).append(' ');
buff.append(getMethodName())
.append(Signature.C_PARAM_START)
.append(getMethodParameters())
.append(Signature.C_PARAM_END);
buff.append(getMethodThrows());
return BasicElementLabels.getJavaCodeString(buff.toString());
}
示例10: getNonStaticNonCacheFields
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private IField[] getNonStaticNonCacheFields(IType objectClass, PreferencesManager preferencesManager)
throws JavaModelException {
Set<String> cacheFields = new HashSet<>();
cacheFields.add(preferencesManager.getCurrentPreferenceValue(JeneratePreferences.HASHCODE_CACHING_FIELD));
cacheFields.add(preferencesManager.getCurrentPreferenceValue(JeneratePreferences.TOSTRING_CACHING_FIELD));
IField[] fields;
fields = objectClass.getFields();
List<IField> result = new ArrayList<>();
for (int i = 0, size = fields.length; i < size; i++) {
if (!Flags.isStatic(fields[i].getFlags()) && !cacheFields.contains(fields[i].getElementName())) {
result.add(fields[i]);
}
}
return result.toArray(new IField[result.size()]);
}
示例11: addMethodsToClass
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void addMethodsToClass(IMethod iMethod) throws JavaModelException {
if (iMethod.isConstructor() || iMethod.isMainMethod() || isMethodDepricated(iMethod)) {
return;
} else {
if (Flags.isPublic(iMethod.getFlags()) && Flags.isStatic(iMethod.getFlags())) {
if (StringUtils.isBlank(iMethod.getSource())) {
methodList.add(new MethodDetails(iMethod,cName, false));
} else
methodList.add(new MethodDetails(iMethod,cName, true));
}
}
}
示例12: 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);
}
}
示例13: isFieldVisible
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private boolean isFieldVisible(IField m) {
try {
int f = m.getFlags();
return !Flags.isStatic(f) && isVisibleMember(m);
}
catch (JavaModelException e) {
// e.printStackTrace();
return false;
}
}
示例14: getFieldNameSuggestions
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public static String[] getFieldNameSuggestions(IJavaProject project, String baseName, int dimensions, int modifiers,
String[] excluded) {
if (Flags.isFinal(modifiers) && Flags.isStatic(modifiers)) {
return getVariableNameSuggestions(NamingConventions.VK_STATIC_FINAL_FIELD, project, baseName, dimensions,
new ExcludedCollection(excluded), true);
} else if (Flags.isStatic(modifiers)) {
return getVariableNameSuggestions(NamingConventions.VK_STATIC_FIELD, project, baseName, dimensions,
new ExcludedCollection(excluded), true);
}
return getVariableNameSuggestions(NamingConventions.VK_INSTANCE_FIELD, project, baseName, dimensions,
new ExcludedCollection(excluded), true);
}
示例15: 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 "";
}