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

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

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

Version.greaterThan介绍

[英]Checks if this version is greater than the other version.
[中]检查此版本是否高于其他版本。

代码示例

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

if (reportedVersion.greaterThan(ServerVersion.VERSION.getVersion())) {
  LOG.debug("Reported version is higher than ours ({}). Writing notification.", ServerVersion.VERSION);

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

private UpdateOperationResult executeCheck() throws Exception {
  Version localAppVersion = Version.valueOf(Client.getApplicationVersion());
  String appInfoResponseStr = getAppInfoResponseStr();
  AppInfoResponse appInfoResponse = new Persister().read(AppInfoResponse.class, appInfoResponseStr);
  ArrayList<AppInfo> appInfoList = appInfoResponse.getAppInfoList();
  if (appInfoList.size() > 0) {
    AppInfo remoteAppInfo = appInfoList.get(0);
    Version remoteAppVersion = Version.valueOf(remoteAppInfo.getAppVersion());
    boolean newVersionAvailable = remoteAppVersion.greaterThan(localAppVersion);
    result.setResultCode(UpdateResultCode.OK);
    result.setAppInfo(remoteAppInfo);
    result.setNewVersionAvailable(newVersionAvailable);
    return result;
  }
  else {
    result.setResultCode(UpdateResultCode.NOK);
    return result;
  }
}

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

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

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

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

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

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

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

public boolean isGreaterThan(Version version) {
  return this.version.greaterThan(version.version);
}

代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-spring

private static void logCompatibility(Version server, Version supported, Logger logger) {
  String message = "Client supports API version {} and is connected to server with API version {}. Things may not work as expected.";
  if (server.greaterThan(supported)) {
    logger.info(message, supported, server);
  } else if (server.lessThan(supported)) {
    logger.warn(message, supported, server);
  }
}

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

/**
 * Finds whether the  newer version of the plugin
 * @param systemVersion version of host system where plugin will be installed
 * @param installedVersion version that is already installed
 * @return true if there is a newer version available which is compatible with system
 */
public boolean hasUpdate(Version systemVersion, Version installedVersion) {
  PluginRelease last = getLastRelease(systemVersion);
  return last != null && Version.valueOf(last.version).greaterThan(installedVersion);
}

代码示例来源:origin: reddr/LibScout

/**
 * Given a collection of profiles, return distinct libraries with their highest version
 * @param profiles
 * @return a {@link Map} containing unique library names -> highest version
 */
public static Map<String,String> getUniqueLibraries(Collection<LibProfile> profiles) {
  HashMap<String,String> result = new HashMap<String,String>();
  for (LibProfile p: profiles) {
    if (!result.containsKey(p.description.name))
      result.put(p.description.name, p.description.version);
    else {
      try {
        Version v1 = VersionWrapper.valueOf(result.get(p.description.name));
        Version v2 = VersionWrapper.valueOf(p.description.version);

        if (v2.greaterThan(v1))
          result.put(p.description.name, p.description.version);
      } catch (Exception e) { /* if at least one version is not semver compliant */ }
    }
  }
  return result;
}

代码示例来源:origin: ga4gh/dockstore

/**
 * Figures out which pip requirements file to resolve to since not every clientVersion changes the pip requirements.
 * This function should be modified every time a new pip requirements file is added.
 * @param semVerString  The Dockstore client version
 * @return              The most recently changed pip requirements file to the Dockstore client version
 */
public static String convertSemVerToAvailableVersion(String semVerString) {
  if (semVerString == null || DEV_SEM_VER.equals(semVerString)) {
    semVerString = "9001.9001.9001";
  }
  Version semVer = Version.valueOf(semVerString);
  // Use the 1.5.0 even for snapshot
  if (semVer.greaterThan(Version.valueOf("1.4.0"))) {
    return "1.5.0";
  } else {
    return "1.4.0";
  }
}

代码示例来源:origin: lennartkoopmann/nzyme

VersionResponse versionResponse = om.readValue(responseString, VersionResponse.class);
if (versionResponse.getVersion().greaterThan(version.getVersion())) {
  String text = "You are running an outdated version of nzyme: v"
      + version.getVersionString() + ". The currently available stable version is v"

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

if (reportedVersion.greaterThan(ServerVersion.VERSION.getVersion())) {
  LOG.debug("Reported version is higher than ours ({}). Writing notification.", ServerVersion.VERSION);

代码示例来源:origin: Microsoft/azure-maven-plugins

protected void assureRequirementAddressed() throws Exception {
  final String localVersion = getLocalFunctionCoreToolsVersion();
  final String latestCoreVersion = getLatestFunctionCoreToolsVersion();
  // Ensure azure function core tools has been installed and support extension auto-install
  if (localVersion == null || LEAST_SUPPORTED_VERSION.greaterThan(Version.valueOf(localVersion))) {
    throw new Exception(CANNOT_AUTO_INSTALL);
  }
  // Verify whether local function core tools is the latest version
  if (latestCoreVersion == null) {
    this.mojo.warning(GET_LATEST_VERSION_FAIL);
  } else if (Version.valueOf(localVersion).lessThan(Version.valueOf(latestCoreVersion))) {
    this.mojo.warning(String.format(NEED_UPDATE_FUNCTION_CORE_TOOLS, localVersion, latestCoreVersion));
  }
}

相关文章