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

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

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

Version.getMinorVersion介绍

[英]Returns the minor version number.
[中]返回次要版本号。

代码示例

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

@Override
public String toString() {
  final com.github.zafarkhaja.semver.Version version = Version.CURRENT_CLASSPATH.getVersion();
  final String shortVersion = version.getMajorVersion() + "." + version.getMinorVersion();
  return DOCS_URL + shortVersion + "/pages/" + path;
}

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

private static String currentMinorVersionString() {
    return String.format(Locale.ENGLISH, "%d.%d",
               Version.CURRENT_CLASSPATH.getVersion().getMajorVersion(),
               Version.CURRENT_CLASSPATH.getVersion().getMinorVersion());
  }
}

代码示例来源: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: Graylog2/graylog2-server

final int minor = version.getMinorVersion();
final int patch = version.getPatchVersion();
final String qualifier = version.getPreReleaseVersion();

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

/**
 * Returns the minor version.
 *
 * @return the minor version
 */
public int getMinorVersion() {
  return impl.getMinorVersion();
}

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

@Override
public String toString() {
  final com.github.zafarkhaja.semver.Version version = Version.CURRENT_CLASSPATH.getVersion();
  final String shortVersion = version.getMajorVersion() + "." + version.getMinorVersion();
  return DOCS_URL + shortVersion + "/pages/" + path;
}

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

private static String currentMinorVersionString() {
    return String.format(Locale.ENGLISH, "%d.%d",
               Version.CURRENT_CLASSPATH.getVersion().getMajorVersion(),
               Version.CURRENT_CLASSPATH.getVersion().getMinorVersion());
  }
}

代码示例来源: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: infiniteautomation/ma-core-public

public static final Version normalizeVersion(Version version) {
  return Version.forIntegers(version.getMajorVersion(), version.getMinorVersion(), version.getPatchVersion());
}

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

final int minor = version.getMinorVersion();
final int patch = version.getPatchVersion();
final String qualifier = version.getPreReleaseVersion();

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

if (splits != null && splits.length > 1) {
  if (LEAST_SUPPORTED_CLIENT_VERSION_PREFIX.getMajorVersion() > Integer.parseInt(splits[0])
      || LEAST_SUPPORTED_CLIENT_VERSION_PREFIX.getMinorVersion() > Integer.parseInt(splits[1])) {
    throw new RestException(Status.METHOD_NOT_ALLOWED,
        "Client lib is not compatible to access partitioned metadata: version " + userAgent

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

private Version(com.github.zafarkhaja.semver.Version version) {
 this.version = version;
 // need this if logic to avoid stack overflow
 if (version.getPreReleaseVersion().isEmpty()) {
  this.normal = this;
 } else {
  this.normal = new Version(com.github.zafarkhaja.semver.Version.forIntegers(version.getMajorVersion(), version.getMinorVersion(), version.getPatchVersion()));
 }
 this.stage = Stage.valueOf(version);
}

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

/**
  * Infers the scope between two versions. It looks left-to-right through the components of the
  * normal versions looking for the first difference of 1 that it finds. Anything else is considered
  * an invalid difference. For example, 1.0.0 to 2.0.0 is MAJOR, 1.0.0 to 1.1.0 is MINOR, 1.0.0 to
  * 1.0.1 is PATCH, 1.0.0 to 3.0.0 is invalid.
  * 
  * @param before the earlier version to compare
  * @param after the later version to compare
  * @return the scope of the change between the two versions, or empty if they are the same or have
  *         an invalid increment
  */
 public static Optional<Scope> infer(Version before, Version after) {
  int major = after.getVersion().getMajorVersion() - before.getVersion().getMajorVersion();
  int minor = after.getVersion().getMinorVersion() - before.getVersion().getMinorVersion();
  int patch = after.getVersion().getPatchVersion() - before.getVersion().getPatchVersion();
  if (major == 1 && after.getVersion().getMinorVersion() == 0 && after.getVersion().getPatchVersion() == 0) {
   return Optional.of(Scope.MAJOR);
  } else if (major == 0 && minor == 1 && after.getVersion().getPatchVersion() == 0) {
   return Optional.of(Scope.MINOR);
  } else if (major == 0 && minor == 0 && patch == 1) {
   return Optional.of(Scope.PATCH);
  } else {
   return Optional.empty();
  }
 }
}

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

if (v0.getMinorVersion() < v1.getMinorVersion()) {
  return SEMVER.MINOR.toString();
} else if (v0.getMinorVersion() == v1.getMinorVersion()) {

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

相关文章