本文整理汇总了Java中org.eclipse.jdt.core.dom.IBinding.isDeprecated方法的典型用法代码示例。如果您正苦于以下问题:Java IBinding.isDeprecated方法的具体用法?Java IBinding.isDeprecated怎么用?Java IBinding.isDeprecated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.IBinding
的用法示例。
在下文中一共展示了IBinding.isDeprecated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdornmentFlags
import org.eclipse.jdt.core.dom.IBinding; //导入方法依赖的package包/类
private static int getAdornmentFlags(IBinding binding) {
int adornments = 0;
final int modifiers = binding.getModifiers();
if (Modifier.isAbstract(modifiers)) adornments |= JavaElementImageDescriptor.ABSTRACT;
if (Modifier.isFinal(modifiers)) adornments |= JavaElementImageDescriptor.FINAL;
if (Modifier.isStatic(modifiers)) adornments |= JavaElementImageDescriptor.STATIC;
if (binding.isDeprecated()) adornments |= JavaElementImageDescriptor.DEPRECATED;
if (binding instanceof IMethodBinding) {
if (((IMethodBinding) binding).isConstructor())
adornments |= JavaElementImageDescriptor.CONSTRUCTOR;
if (Modifier.isSynchronized(modifiers)) adornments |= JavaElementImageDescriptor.SYNCHRONIZED;
if (Modifier.isNative(modifiers)) adornments |= JavaElementImageDescriptor.NATIVE;
ITypeBinding type = ((IMethodBinding) binding).getDeclaringClass();
if (type.isInterface() && !Modifier.isAbstract(modifiers) && !Modifier.isStatic(modifiers))
adornments |= JavaElementImageDescriptor.DEFAULT_METHOD;
if (((IMethodBinding) binding).getDefaultValue() != null)
adornments |= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
}
if (binding instanceof IVariableBinding && ((IVariableBinding) binding).isField()) {
if (Modifier.isTransient(modifiers)) adornments |= JavaElementImageDescriptor.TRANSIENT;
if (Modifier.isVolatile(modifiers)) adornments |= JavaElementImageDescriptor.VOLATILE;
}
return adornments;
}
示例2: consumes
import org.eclipse.jdt.core.dom.IBinding; //导入方法依赖的package包/类
@Override
public boolean consumes(SemanticToken token) {
IBinding binding = getBinding(token);
if (binding != null) {
if (binding.isDeprecated()) return true;
if (binding instanceof IMethodBinding) {
IMethodBinding methodBinding = (IMethodBinding) binding;
if (methodBinding.isConstructor() && methodBinding.getJavaElement() == null) {
ITypeBinding declaringClass = methodBinding.getDeclaringClass();
if (declaringClass.isAnonymous()) {
ITypeBinding[] interfaces = declaringClass.getInterfaces();
if (interfaces.length > 0) return interfaces[0].isDeprecated();
else return declaringClass.getSuperclass().isDeprecated();
}
return declaringClass.isDeprecated();
}
}
}
return false;
}