info.magnolia.module.model.Version.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(105)

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

Version.<init>介绍

[英]Convenience constructor that could be used to register Deltas or update tasks.
[中]方便的构造函数,可用于注册增量或更新任务。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

public static Version parseVersion(int major, int minor, int patch) {
  return new Version(major, minor, patch);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Factory method that will parse a version string and return the correct Version implementation.
 *
 * @param versionStr version as string, for example <code>1.2.3-test</code>. The String
 * <code>${project.version}</code> is interpreted as an undefined version during development ant it will always
 * match version ranges
 * @return a Version implementation, never null
 */
public static Version parseVersion(String versionStr) {
  versionStr = versionStr.trim();
  log.debug("parsing version [{}]", versionStr);
  if (UndefinedDevelopmentVersion.isDevelopmentVersion(versionStr)) {
    // development mode.
    return UNDEFINED_DEVELOPMENT_VERSION;
  }
  return new Version(versionStr);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testUndefinedDeveloperVersion() {
  Version realVersion = new Version(3, 1, 1);
  assertTrue(Version.parseVersion(Version.UndefinedDevelopmentVersion.KEY) instanceof UndefinedDevelopmentVersion);
  assertTrue(Version.UNDEFINED_DEVELOPMENT_VERSION.isEquivalent(realVersion));
  assertTrue(Version.UNDEFINED_DEVELOPMENT_VERSION.isBeforeOrEquivalent(realVersion));
  assertFalse(Version.UNDEFINED_DEVELOPMENT_VERSION.isStrictlyAfter(realVersion));
  assertTrue(realVersion.isEquivalent(Version.UNDEFINED_DEVELOPMENT_VERSION));
  assertTrue(realVersion.isBeforeOrEquivalent(Version.UNDEFINED_DEVELOPMENT_VERSION));
  assertFalse(realVersion.isStrictlyAfter(Version.UNDEFINED_DEVELOPMENT_VERSION));
  assertTrue(Version.UNDEFINED_DEVELOPMENT_VERSION.isEquivalent(Version.UNDEFINED_DEVELOPMENT_VERSION));
  assertTrue(Version.UNDEFINED_DEVELOPMENT_VERSION.isBeforeOrEquivalent(Version.UNDEFINED_DEVELOPMENT_VERSION));
  assertFalse(Version.UNDEFINED_DEVELOPMENT_VERSION.isStrictlyAfter(Version.UNDEFINED_DEVELOPMENT_VERSION));
}

相关文章