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


Java JdtFlags.isFinal方法代码示例

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


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

示例1: isInterfaceMigrationAvailable

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isInterfaceMigrationAvailable(IMethod method, boolean allowConcreteClasses,
		Optional<IProgressMonitor> monitor) throws JavaModelException {
	if (!Checks.isAvailable(method))
		return false;
	if (method.isConstructor())
		return false;
	if (JdtFlags.isNative(method))
		return false;
	if (JdtFlags.isStatic(method))
		return false;
	if (JdtFlags.isAbstract(method))
		return false;
	// TODO: Should this be here?
	if (JdtFlags.isSynchronized(method))
		return false;
	// TODO: Should this be here?
	if (JdtFlags.isFinal(method))
		return false;
	if (method.getResource().isDerived(IResource.CHECK_ANCESTORS))
		return false;

	final IType declaring = method.getDeclaringType();
	if (declaring != null)
		if (declaring.isInterface())
			return false; // Method is already in an interface
		else if (!allowConcreteClasses && !Flags.isAbstract(declaring.getFlags()))
			return false; // no concrete types allowed.

	// ensure that there is a target method.
	IMethod targetMethod = MigrateSkeletalImplementationToInterfaceRefactoringProcessor.getTargetMethod(method,
			monitor);
	if (targetMethod == null) // no possible target.
		return false;

	return true;
}
 
开发者ID:ponder-lab,项目名称:Migrate-Skeletal-Implementation-to-Interface-Refactoring,代码行数:37,代码来源:RefactoringAvailabilityTester.java

示例2: isExtractableMember

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
/**
 * Is the specified member extractable from the type?
 *
 * @param member
 *            the member to test
 * @return <code>true</code> if the member is extractable,
 *         <code>false</code> otherwise
 * @throws JavaModelException
 *             if an error occurs
 */
protected static boolean isExtractableMember(final IMember member) throws JavaModelException {
	Assert.isNotNull(member);
	switch (member.getElementType()) {
		case IJavaElement.METHOD:
			return JdtFlags.isPublic(member) && !JdtFlags.isStatic(member) && !((IMethod) member).isConstructor();
		case IJavaElement.FIELD:
			return JdtFlags.isPublic(member) && JdtFlags.isStatic(member) && JdtFlags.isFinal(member) && !JdtFlags.isEnum(member);
		default:
			return false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:ExtractInterfaceProcessor.java

示例3: needsSetter

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private boolean needsSetter() {
	try {
		return !JdtFlags.isFinal(fRefactoring.getField());
	} catch(JavaModelException e) {
		return true;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:SelfEncapsulateFieldInputPage.java

示例4: isStaticFinal

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
/**
 * Tells whether the given field is static final.
 * 
 * @param field the member to test
 * @return <code>true</code> if static final
 * @since 3.4
 */
public static boolean isStaticFinal(IField field) {
	try {
		return JdtFlags.isFinal(field) && JdtFlags.isStatic(field);
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
		return false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:JavadocHover.java

示例5: evaluateProposals

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static void evaluateProposals(IType type, String prefix, int offset, int length, int relevance, Set<String> suggestedMethods, Collection<IJavaCompletionProposal> result) throws CoreException {
	if (prefix.length() == 0) {
		relevance--;
	}

	IField[] fields= type.getFields();
	IMethod[] methods= type.getMethods();
	for (int i= 0; i < fields.length; i++) {
		IField curr= fields[i];
		if (!JdtFlags.isEnum(curr)) {
			String getterName= GetterSetterUtil.getGetterName(curr, null);
			if (Strings.startsWithIgnoreCase(getterName, prefix) && !hasMethod(methods, getterName)) {
				suggestedMethods.add(getterName);
				int getterRelevance= relevance;
				if (JdtFlags.isStatic(curr) && JdtFlags.isFinal(curr))
					getterRelevance= relevance - 1;
				result.add(new GetterSetterCompletionProposal(curr, offset, length, true, getterRelevance));
			}

			if (!JdtFlags.isFinal(curr)) {
				String setterName= GetterSetterUtil.getSetterName(curr, null);
				if (Strings.startsWithIgnoreCase(setterName, prefix) && !hasMethod(methods, setterName)) {
					suggestedMethods.add(setterName);
					result.add(new GetterSetterCompletionProposal(curr, offset, length, false, relevance));
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:GetterSetterCompletionProposal.java

示例6: isStaticFinal

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
/**
 * Tells whether the given member is static final.
 * <p>
 * XXX: Copied from {@link JavadocHover}.
 * </p>
 * @param member the member to test
 * @return <code>true</code> if static final
 * @since 3.4
 */
private static boolean isStaticFinal(IJavaElement member) {
	if (member.getElementType() != IJavaElement.FIELD)
		return false;

	IField field= (IField)member;
	try {
		return JdtFlags.isFinal(field) && JdtFlags.isStatic(field);
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
		return false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:JavadocView.java

示例7: isStaticFinal

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private static boolean isStaticFinal(IField field) {
	try {
		return JdtFlags.isFinal(field) && JdtFlags.isStatic(field);
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
		return false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:9,代码来源:JavadocHover.java

示例8: isInlineConstantAvailable

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isInlineConstantAvailable(final IField field) throws JavaModelException {
  return Checks.isAvailable(field)
      && JdtFlags.isStatic(field)
      && JdtFlags.isFinal(field)
      && !JdtFlags.isEnum(field);
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:RefactoringAvailabilityTester.java

示例9: isInlineConstantAvailable

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isInlineConstantAvailable(final IField field) throws JavaModelException {
	return Checks.isAvailable(field) && JdtFlags.isStatic(field) && JdtFlags.isFinal(field) && !JdtFlags.isEnum(field);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:RefactoringAvailabilityTester.java

示例10: cannotBeOverriddenMethod

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
/**
 * Checks whether or not a method can be overridden.
 * 
 * @param method the method
 * @return <code>true</code> if the method cannot be overridden, <code>false</code> otherwise
 * @throws JavaModelException if this element does not exist or if an exception occurs while
 *             accessing its corresponding resource
 * @since 3.7
 */
private static boolean cannotBeOverriddenMethod(IMethod method) throws JavaModelException {
	return JdtFlags.isPrivate(method) || JdtFlags.isFinal(method) || JdtFlags.isStatic(method) || method.isConstructor()
			|| JdtFlags.isFinal((IMember)method.getParent());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:JavaElementImplementationHyperlink.java


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