net.sourceforge.pmd.Rule.getMinimumLanguageVersion()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中net.sourceforge.pmd.Rule.getMinimumLanguageVersion方法的一些代码示例,展示了Rule.getMinimumLanguageVersion的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rule.getMinimumLanguageVersion方法的具体详情如下:
包路径:net.sourceforge.pmd.Rule
类名称:Rule
方法名:getMinimumLanguageVersion

Rule.getMinimumLanguageVersion介绍

[英]Get the minimum LanguageVersion to which this Rule applies. If this value is null it indicates there is no minimum bound.
[中]获取此规则适用的最低语言版本。如果此值为null,则表示没有最小界限。

代码示例

代码示例来源:origin: pmd/pmd

@Override
public LanguageVersion getMinimumLanguageVersion() {
  return rule.getMinimumLanguageVersion();
}

代码示例来源:origin: pmd/pmd

private void checkLanguageVersionsAreOrdered(Rule rule) {
  if (rule.getMinimumLanguageVersion() != null && rule.getMaximumLanguageVersion() != null
    && rule.getMinimumLanguageVersion().compareTo(rule.getMaximumLanguageVersion()) > 0) {
    throw new IllegalArgumentException(
        "The minimum Language Version '" + rule.getMinimumLanguageVersion().getTerseName()
        + "' must be prior to the maximum Language Version '"
        + rule.getMaximumLanguageVersion().getTerseName() + "' for Rule '" + name
        + "'; perhaps swap them around?");
  }
}

代码示例来源:origin: pmd/pmd

/**
 * Does the given Rule apply to the given LanguageVersion? If so, the
 * Language must be the same and be between the minimum and maximums
 * versions on the Rule.
 *
 * @param rule
 *            The rule.
 * @param languageVersion
 *            The language version.
 *
 * @return <code>true</code> if the given rule matches the given language,
 *         which means, that the rule would be executed.
 */
public static boolean applies(Rule rule, LanguageVersion languageVersion) {
  final LanguageVersion min = rule.getMinimumLanguageVersion();
  final LanguageVersion max = rule.getMaximumLanguageVersion();
  return rule.getLanguage().equals(languageVersion.getLanguage())
      && (min == null || min.compareTo(languageVersion) <= 0)
      && (max == null || max.compareTo(languageVersion) >= 0);
}

代码示例来源:origin: pmd/pmd

lines.add("");
if (rule.getMinimumLanguageVersion() != null) {
  lines.add("**Minimum Language Version:** "
      + rule.getLanguage().getName() + " " + rule.getMinimumLanguageVersion().getVersion());
  lines.add("");

代码示例来源:origin: pmd/pmd

rule.getMinimumLanguageVersion(), rule.getMaximumLanguageVersion(), rule.isDeprecated(),
rule.getName(), rule.getSince(), null, rule.getMessage(), rule.getExternalInfoUrl(),
rule.getRuleClass(), rule.isDfa(), rule.isTypeResolution(), rule.isMultifile(),

代码示例来源:origin: net.sourceforge.pmd/pmd-core

@Override
public LanguageVersion getMinimumLanguageVersion() {
  return rule.getMinimumLanguageVersion();
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

private void checkLanguageVersionsAreOrdered(Rule rule) {
  if (rule.getMinimumLanguageVersion() != null && rule.getMaximumLanguageVersion() != null
    && rule.getMinimumLanguageVersion().compareTo(rule.getMaximumLanguageVersion()) > 0) {
    throw new IllegalArgumentException(
        "The minimum Language Version '" + rule.getMinimumLanguageVersion().getTerseName()
        + "' must be prior to the maximum Language Version '"
        + rule.getMaximumLanguageVersion().getTerseName() + "' for Rule '" + name
        + "'; perhaps swap them around?");
  }
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

/**
 * Does the given Rule apply to the given LanguageVersion? If so, the
 * Language must be the same and be between the minimum and maximums
 * versions on the Rule.
 *
 * @param rule
 *            The rule.
 * @param languageVersion
 *            The language version.
 *
 * @return <code>true</code> if the given rule matches the given language,
 *         which means, that the rule would be executed.
 */
public static boolean applies(Rule rule, LanguageVersion languageVersion) {
  final LanguageVersion min = rule.getMinimumLanguageVersion();
  final LanguageVersion max = rule.getMaximumLanguageVersion();
  return rule.getLanguage().equals(languageVersion.getLanguage())
      && (min == null || min.compareTo(languageVersion) <= 0)
      && (max == null || max.compareTo(languageVersion) >= 0);
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

rule.getMinimumLanguageVersion(), rule.getMaximumLanguageVersion(), rule.isDeprecated(),
rule.getName(), rule.getSince(), null, rule.getMessage(), rule.getExternalInfoUrl(),
rule.getRuleClass(), rule.isDfa(), rule.isTypeResolution(), rule.isMultifile(),

相关文章