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

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

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

Version.getBuildMetadata介绍

[英]Returns the string representation of the build metadata.
[中]返回生成元数据的字符串表示形式。

代码示例

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

public Version(com.github.zafarkhaja.semver.Version version) {
  this.version = requireNonNull(version);
  // Deprecated
  this.major = version.getMajorVersion();
  this.minor = version.getMinorVersion();
  this.patch = version.getPatchVersion();
  this.additional = version.getPreReleaseVersion();
  this.abbrevCommitSha = version.getBuildMetadata();
}

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

public String getBuildNumber(){
  return this.version.getBuildMetadata();
}

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

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder(getNormalVersion());
  if (!getPreReleaseVersion().isEmpty()) {
    sb.append(PRE_RELEASE_PREFIX).append(getPreReleaseVersion());
  }
  if (!getBuildMetadata().isEmpty()) {
    sb.append(BUILD_PREFIX).append(getBuildMetadata());
  }
  return sb.toString();
}

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

/**
 * {@inheritDoc}.
 */
@Override
public String toString() {
 StringBuilder sb = new StringBuilder(getNormalVersion());
 if (!getPreReleaseVersion().isEmpty()) {
  sb.append(PRE_RELEASE_PREFIX).append(getPreReleaseVersion());
 }
 if (!getBuildMetadata().isEmpty()) {
  sb.append(BUILD_PREFIX).append(getBuildMetadata());
 }
 return sb.toString();
}

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

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder(getNormalVersion());
  if (!getPreReleaseVersion().isEmpty()) {
    sb.append(PRE_RELEASE_PREFIX).append(getPreReleaseVersion());
  }
  if (!getBuildMetadata().isEmpty()) {
    sb.append(BUILD_PREFIX).append(getBuildMetadata());
  }
  return sb.toString();
}

代码示例来源:origin: org.ajoberstar.reckon/reckon-core

/**
 * @return {@code true} if the version is final or any other significant stage, {@code false} if
 *         insignficant or snapshot
 */
public boolean isSignificant() {
 return isFinal() || getStage()
   .filter(stage -> !"SNAPSHOT".equals(stage.getName()))
   .filter(stage -> version.getBuildMetadata().isEmpty())
   .isPresent();
}

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

public static String getTruncatedVersion(Version v) {
    String vStr = "" + v.getMajorVersion();
    if (v.getMinorVersion() > 0  || (v.getMinorVersion() == 0 && v.getPatchVersion() > 0)) {
      vStr += "." + v.getMinorVersion();

      if (v.getPatchVersion() > 0)
        vStr += "." + v.getPatchVersion();

      if (v.getBuildMetadata().length() > 1)
        vStr += "-" + v.getBuildMetadata();
    }
    return vStr;
  }
}

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

public Version(com.github.zafarkhaja.semver.Version version) {
  this.version = requireNonNull(version);
  // Deprecated
  this.major = version.getMajorVersion();
  this.minor = version.getMinorVersion();
  this.patch = version.getPatchVersion();
  this.additional = version.getPreReleaseVersion();
  this.abbrevCommitSha = version.getBuildMetadata();
}

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

public static SEMVER getExpectedSemver(Version v0, Version v1) {
  if (v0.getMajorVersion() < v1.getMajorVersion()) {
    return SEMVER.MAJOR;
  }
  else if (v0.getMajorVersion() == v1.getMajorVersion()) {
    if (v0.getMinorVersion() < v1.getMinorVersion()) {
      return SEMVER.MINOR;
    } else if (v0.getMinorVersion() == v1.getMinorVersion()) {
      if (v0.getPatchVersion() < v1.getPatchVersion()) {
        return SEMVER.PATCH;
      } else if (v0.getPatchVersion() == v1.getPatchVersion()) {
        if (!v1.getBuildMetadata().isEmpty())  // subpatch levels are encoded by build meta data through VersionWrapper
          return SEMVER.PATCH;
      } else
        return null;
    }
  }
  return null;
}

代码示例来源:origin: cinchapi/concourse

@Test
public void testParseCinchapiFeatureBranchSemanticVersion() {
  int major = 0;
  int minor = 5;
  int patch = 0;
  int build = 26;
  String snapshot = "-CON-512";
  String cinchapiVersion = Strings.format("{}.{}.{}.{}{}", major, minor,
      patch, build, snapshot);
  Version version = Versions.parseSemanticVersion(cinchapiVersion);
  Assert.assertEquals(major, version.getMajorVersion());
  Assert.assertEquals(minor, version.getMinorVersion());
  Assert.assertEquals(patch, version.getPatchVersion());
  Assert.assertEquals(String.valueOf(build), version.getBuildMetadata());
}

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

return SEMVER.PATCH.toString();
} else if (v0.getPatchVersion() == v1.getPatchVersion()) {
  if (!v1.getBuildMetadata().isEmpty())  // subpatch levels are encoded by build meta data through VersionWrapper
    return SEMVER.PATCH.toString();
} else

代码示例来源:origin: cinchapi/concourse

@Test
public void testParseCinchapiSemanticVersion() {
  int major = Random.getScaleCount();
  int minor = Random.getScaleCount();
  int patch = Random.getScaleCount();
  int build = Random.getScaleCount();
  String snapshot = Random.getBoolean() ? "-SNAPSHOT" : "";
  String cinchapiVersion = Strings.format("{}.{}.{}.{}{}", major, minor,
      patch, build, snapshot);
  Version version = Versions.parseSemanticVersion(cinchapiVersion);
  Assert.assertEquals(major, version.getMajorVersion());
  Assert.assertEquals(minor, version.getMinorVersion());
  Assert.assertEquals(patch, version.getPatchVersion());
  Assert.assertEquals(String.valueOf(build), version.getBuildMetadata());
}

相关文章