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

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

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

Version.lessThan介绍

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

代码示例

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

private void checkPluginCompatibility(PluginInfo pluginInfo) throws Exception {
  Version applicationVersion = Version.valueOf(Client.getApplicationVersion());
  Version pluginAppMinVersion = Version.valueOf(pluginInfo.getPluginAppMinVersion());
  logger.log(Level.INFO, "Checking plugin compatibility:");
  logger.log(Level.INFO, "- Application version:             " + Client.getApplicationVersion() + "(" + applicationVersion + ")");
  logger.log(Level.INFO, "- Plugin min. application version: " + pluginInfo.getPluginAppMinVersion() + "(" + pluginAppMinVersion + ")");
  if (applicationVersion.lessThan(pluginAppMinVersion)) {
    throw new Exception("Plugin is incompatible to this application version. Plugin min. application version is "
            + pluginInfo.getPluginAppMinVersion() + ", current application version is " + Client.getApplicationVersion());
  }
  // Verify if any conflicting plugins are installed
  logger.log(Level.INFO, "Checking for conflicting plugins.");
  List<String> conflictingIds = pluginInfo.getConflictingPluginIds();
  List<String> conflictingInstalledIds = new ArrayList<String>();
  if (conflictingIds != null) {
    for (String pluginId : conflictingIds) {
      Plugin plugin = Plugins.get(pluginId);
      if (plugin != null) {
        logger.log(Level.INFO, "- Conflicting plugin " + pluginId + " found.");
        conflictingInstalledIds.add(pluginId);
      }
      logger.log(Level.FINE, "- Conflicting plugin " + pluginId + " not installed");
    }
  }
  result.setConflictingPlugins(conflictingInstalledIds);
}

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

if (mongoVersion != null && mongoVersion.lessThan(MINIMUM_MONGODB_VERSION)) {
  LOG.warn("You're running MongoDB {} but Graylog requires at least MongoDB {}. Please upgrade.",
      mongoVersion, MINIMUM_MONGODB_VERSION);

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

Version remoteMinAppVersion = Version.valueOf(remotePluginInfo.getPluginAppMinVersion());
boolean localVersionOutdated = localVersion.lessThan(remoteVersion);
boolean applicationVersionCompatible = applicationVersion.greaterThanOrEqualTo(remoteMinAppVersion);
boolean pluginIsOutdated = localVersionOutdated && applicationVersionCompatible;

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

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

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

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

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

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

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

public boolean isLessThan(Version version) {
  return this.version.lessThan(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: org.springframework.cloud/spring-cloud-dataflow-server-cloudfoundry-autoconfig

@Override
  public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
    AnnotationConfigApplicationContext applicationContext = null;
    // Create a throwaway AppContext to connect to CC API and assess its version.
    try {
      applicationContext = new AnnotationConfigApplicationContext();
      applicationContext.register(CloudFoundryDeployerAutoConfiguration.EarlyConnectionConfiguration.class);
      applicationContext.setEnvironment(environment); // Inherit current environment
      applicationContext.refresh();

      Version version = applicationContext.getBean(Version.class);
      if (version.lessThan(UnsupportedVersionTaskLauncher.MINIMUM_SUPPORTED_VERSION)) {
        logger.warn("Targeting Cloud Foundry API {}, which is incompatible with TaskLauncher support. Forcing {} to false",
            version, TASKS_KEY);
        environment.getPropertySources().addFirst(new MapPropertySource(TASK_FEATURE_DEACTIVE_PROPERTIES,
            Collections.singletonMap(TASKS_KEY, "false")));
      }
    }
    catch (Exception ignored) { // Might happen in particular in Integration Tests not targeting an actual CF runtime
      logger.warn("Could not connect to Cloud Foundry to probe API version", ignored);
    }
    finally {
      if (applicationContext != null) {
        applicationContext.close();
      }
    }
  }
}

代码示例来源: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));
  }
}

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

if (mongoVersion != null && mongoVersion.lessThan(MINIMUM_MONGODB_VERSION)) {
  LOG.warn("You're running MongoDB {} but Graylog requires at least MongoDB {}. Please upgrade.",
      mongoVersion, MINIMUM_MONGODB_VERSION);

相关文章