本文整理汇总了Java中org.eclipse.jdt.core.IAccessRule.IGNORE_IF_BETTER属性的典型用法代码示例。如果您正苦于以下问题:Java IAccessRule.IGNORE_IF_BETTER属性的具体用法?Java IAccessRule.IGNORE_IF_BETTER怎么用?Java IAccessRule.IGNORE_IF_BETTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.IAccessRule
的用法示例。
在下文中一共展示了IAccessRule.IGNORE_IF_BETTER属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeAccessRules
static IAccessRule[] decodeAccessRules(NodeList list) {
if (list == null) return null;
int length = list.getLength();
if (length == 0) return null;
IAccessRule[] result = new IAccessRule[length];
int index = 0;
for (int i = 0; i < length; i++) {
Node accessRule = list.item(i);
if (accessRule.getNodeType() == Node.ELEMENT_NODE) {
Element elementAccessRule = (Element) accessRule;
String pattern = elementAccessRule.getAttribute(TAG_PATTERN);
if (pattern == null) continue;
String tagKind = elementAccessRule.getAttribute(TAG_KIND);
int kind;
if (TAG_ACCESSIBLE.equals(tagKind)) kind = IAccessRule.K_ACCESSIBLE;
else if (TAG_NON_ACCESSIBLE.equals(tagKind)) kind = IAccessRule.K_NON_ACCESSIBLE;
else if (TAG_DISCOURAGED.equals(tagKind)) kind = IAccessRule.K_DISCOURAGED;
else continue;
boolean ignoreIfBetter =
"true".equals(elementAccessRule.getAttribute(TAG_IGNORE_IF_BETTER)); // $NON-NLS-1$
result[index++] =
new ClasspathAccessRule(
new Path(pattern), ignoreIfBetter ? kind | IAccessRule.IGNORE_IF_BETTER : kind);
}
}
if (index != length) System.arraycopy(result, 0, result = new IAccessRule[index], 0, index);
return result;
}
示例2: toProblemId
private static int toProblemId(int kind) {
boolean ignoreIfBetter = (kind & IAccessRule.IGNORE_IF_BETTER) != 0;
switch (kind & ~IAccessRule.IGNORE_IF_BETTER) {
case K_NON_ACCESSIBLE:
return ignoreIfBetter ? IProblem.ForbiddenReference | AccessRule.IgnoreIfBetter : IProblem.ForbiddenReference;
case K_DISCOURAGED:
return ignoreIfBetter ? IProblem.DiscouragedReference | AccessRule.IgnoreIfBetter : IProblem.DiscouragedReference;
default:
return ignoreIfBetter ? AccessRule.IgnoreIfBetter : 0;
}
}
示例3: decodeAccessRules
static IAccessRule[] decodeAccessRules(NodeList list) {
if (list == null) return null;
int length = list.getLength();
if (length == 0) return null;
IAccessRule[] result = new IAccessRule[length];
int index = 0;
for (int i = 0; i < length; i++) {
Node accessRule = list.item(i);
if (accessRule.getNodeType() == Node.ELEMENT_NODE) {
Element elementAccessRule = (Element) accessRule;
String pattern = elementAccessRule.getAttribute(TAG_PATTERN);
if (pattern == null) continue;
String tagKind = elementAccessRule.getAttribute(TAG_KIND);
int kind;
if (TAG_ACCESSIBLE.equals(tagKind))
kind = IAccessRule.K_ACCESSIBLE;
else if (TAG_NON_ACCESSIBLE.equals(tagKind))
kind = IAccessRule.K_NON_ACCESSIBLE;
else if (TAG_DISCOURAGED.equals(tagKind))
kind = IAccessRule.K_DISCOURAGED;
else
continue;
boolean ignoreIfBetter = "true".equals(elementAccessRule.getAttribute(TAG_IGNORE_IF_BETTER)); //$NON-NLS-1$
result[index++] = new ClasspathAccessRule(new Path(pattern), ignoreIfBetter ? kind | IAccessRule.IGNORE_IF_BETTER : kind);
}
}
if (index != length)
System.arraycopy(result, 0, result = new IAccessRule[index], 0, index);
return result;
}