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

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

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

Version.setBuildMetadata介绍

[英]Sets the build metadata.
[中]设置生成元数据。

代码示例

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

private static com.github.zafarkhaja.semver.Version buildSemVer(int major, int minor, int patch, String preRelease, String buildMetadata) {
  com.github.zafarkhaja.semver.Version version = com.github.zafarkhaja.semver.Version.forIntegers(major, minor, patch);
  if (!isNullOrEmpty(preRelease)) {
    version = version.setPreReleaseVersion(preRelease);
  }
  if (!isNullOrEmpty(buildMetadata)) {
    version = version.setBuildMetadata(buildMetadata);
  }
  return version;
}

代码示例来源:origin: infiniteautomation/ma-core-public

private static final Version loadCoreVersionFromReleaseProperties(Version version) {
  if (releaseProps != null) {
    String versionStr = releaseProps.getProperty(ModuleUtils.Constants.PROP_VERSION);
    String buildNumberStr = releaseProps.getProperty(ModuleUtils.Constants.BUILD_NUMBER);
    if (versionStr != null) {
      try {
        version = Version.valueOf(versionStr);
      } catch (com.github.zafarkhaja.semver.ParseException e) { }
    }
    if (buildNumberStr != null) {
      version = version.setBuildMetadata(buildNumberStr);
    }
  }
  return version;
}

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

private static com.github.zafarkhaja.semver.Version buildSemVer(int major, int minor, int patch, String preRelease, String buildMetadata) {
  com.github.zafarkhaja.semver.Version version = com.github.zafarkhaja.semver.Version.forIntegers(major, minor, patch);
  if (!isNullOrEmpty(preRelease)) {
    version = version.setPreReleaseVersion(preRelease);
  }
  if (!isNullOrEmpty(buildMetadata)) {
    version = version.setBuildMetadata(buildMetadata);
  }
  return version;
}

相关文章