com.github.zafarkhaja.semver.Version.equals()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(95)

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

Version.equals介绍

[英]Checks if this version equals the other version. The comparison is done by the Version.compareTo method.
[中]

代码示例

代码示例来源:origin: Graylog2/graylog2-server

/**
 * {@inheritDoc}
 */
@Override
public boolean equals(final Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  final Version that = (Version) o;
  return version.equals(that.getVersion());
}

代码示例来源:origin: org.kurento/kurento-module-creator

/**
 * Checks if the current version equals the parsed version.
 *
 * @param version
 *          the version to compare to, the left-hand operand of the "equal" operator
 * @return {@code true} if the version equals the parsed version or {@code false} otherwise
 */
@Override
public boolean interpret(Version version) {
 return version.equals(parsedVersion);
}

代码示例来源:origin: org.kurento/kurento-module-creator

/**
 * Checks if the current version does not equal the parsed version.
 *
 * @param version
 *          the version to compare with, the left-hand operand of the "not equal" operator
 * @return {@code true} if the version does not equal the parsed version or {@code false}
 *         otherwise
 */
@Override
public boolean interpret(Version version) {
 return !version.equals(parsedVersion);
}

代码示例来源:origin: zafarkhaja/jsemver

/**
   * Checks if the current version does not equal the parsed version.
   *
   * @param version the version to compare with, the left-hand
   *                operand of the "not equal" operator
   * @return {@code true} if the version does not equal the
   *         parsed version or {@code false} otherwise
   */
  @Override
  public boolean interpret(Version version) {
    return !version.equals(parsedVersion);
  }
}

代码示例来源:origin: com.github.zafarkhaja/java-semver

/**
   * Checks if the current version does not equal the parsed version.
   *
   * @param version the version to compare with, the left-hand
   *                operand of the "not equal" operator
   * @return {@code true} if the version does not equal the
   *         parsed version or {@code false} otherwise
   */
  @Override
  public boolean interpret(Version version) {
    return !version.equals(parsedVersion);
  }
}

代码示例来源:origin: zafarkhaja/jsemver

/**
   * Checks if the current version equals the parsed version.
   *
   * @param version the version to compare to, the left-hand
   *                operand of the "equal" operator
   * @return {@code true} if the version equals the
   *         parsed version or {@code false} otherwise
   */
  @Override
  public boolean interpret(Version version) {
    return version.equals(parsedVersion);
  }
}

代码示例来源:origin: com.github.zafarkhaja/java-semver

/**
   * Checks if the current version equals the parsed version.
   *
   * @param version the version to compare to, the left-hand
   *                operand of the "equal" operator
   * @return {@code true} if the version equals the
   *         parsed version or {@code false} otherwise
   */
  @Override
  public boolean interpret(Version version) {
    return version.equals(parsedVersion);
  }
}

代码示例来源:origin: infinum/Android-Prince-of-Versions

public boolean isEqualsTo(Version version) {
  return this.version.equals(version.version);
}

代码示例来源:origin: org.zaproxy/zap

@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  Version other = (Version) obj;
  if (impl == null) {
    if (other.impl != null) {
      return false;
    }
  } else if (!impl.equals(other.impl)) {
    return false;
  }
  return true;
}

代码示例来源:origin: org.graylog2/graylog2-server

/**
 * {@inheritDoc}
 */
@Override
public boolean equals(final Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  final Version that = (Version) o;
  return version.equals(that.getVersion());
}

代码示例来源:origin: ro.fortsoft.pf4j/pf4j-update

/**
 * Returns the last release version of this plugin for given system version, regardless of release date
 * @param systemVersion version of host system where plugin will be installed
 * @return PluginRelease which has the highest version number
 */
public PluginRelease getLastRelease(Version systemVersion) {
  if (!lastRelease.containsKey(systemVersion)) {
    for (PluginRelease release : releases) {
      Expression requires = release.getRequiresExpression();
      if (systemVersion.equals(Version.forIntegers(0, 0, 0)) || systemVersion.satisfies(requires)) {
        if (lastRelease.get(systemVersion) == null) {
          lastRelease.put(systemVersion, release);
        } else if (release.compareTo(lastRelease.get(systemVersion)) > 0) {
          lastRelease.put(systemVersion, release);
        }
      }
    }
  }
  return lastRelease.get(systemVersion);
}

代码示例来源:origin: org.apache.pulsar/pulsar-broker

com.github.zafarkhaja.semver.Version brokerVersionVersion = Version.valueOf(brokerVersion);
if ( brokerVersionVersion.equals(latestVersion) ) {
  LOG.debug("Broker [{}] is running the latest version ([{}])", broker, brokerVersion);
  ++numBrokersLatestVersion;

代码示例来源:origin: com.yahoo.pulsar/pulsar-broker

com.github.zafarkhaja.semver.Version brokerVersionVersion = Version.valueOf(brokerVersion);
if ( brokerVersionVersion.equals(latestVersion) ) {
  LOG.debug("Broker [{}] is running the latest version ([{}])", broker, brokerVersion);
  ++numBrokersLatestVersion;

代码示例来源:origin: ro.fortsoft.pf4j/pf4j-update

/**
 * Resolves url from id and version
 * @param id of plugin
 * @param version of plugin or null to locate latest version
 * @return URL for downloading
 * @throws PluginException if id or version does not exist
 */
protected URL findUrlForPlugin(String id, String version) throws PluginException {
  PluginInfo plugin = getPluginsMap().get(id);
  if (plugin == null) {
    log.info("Plugin with id {} does not exist in any repository", id);
    throw new PluginException("Plugin with id {} not found in any repository", id);
  }
  try {
    if (version == null) {
      return new URL(plugin.getLastRelease(getSystemVersion()).url);
    }
    for (PluginRelease release : plugin.releases) {
      if (Version.valueOf(version).equals(Version.valueOf(release.version)) && release.url != null) {
        return new URL(release.url);
      }
    }
  } catch (MalformedURLException e) {
    throw new PluginException(e);
  }
  throw new PluginException("Plugin {} with version @{} does not exist in the repository", id, version);
}

代码示例来源:origin: ro.fortsoft.pf4j/pf4j

/**
 * Check if this plugin is valid (satisfies "requires" param) for a given system version
 * @param pluginWrapper the plugin to check
 * @return true if plugin satisfies the "requires" or if requires was left blank
 */
protected boolean isPluginValid(PluginWrapper pluginWrapper) {
  String requires = pluginWrapper.getDescriptor().getRequires().trim();
  if (!isExactVersionAllowed() && requires.matches("^\\d+\\.\\d+\\.\\d+$")) {
    // If exact versions are not allowed in requires, rewrite to >= expression
    requires = ">=" + requires;
  }
  if (systemVersion.equals(Version.forIntegers(0,0,0)) || systemVersion.satisfies(requires)) {
    return true;
  }
  log.warn("Plugin '{}:{}' requires a minimum system version of {}, and you have {}",
    pluginWrapper.getPluginId(),
    pluginWrapper.getDescriptor().getVersion(),
    pluginWrapper.getDescriptor().getRequires(),
    getSystemVersion());
  return false;
}

相关文章