org.jboss.forge.furnace.versions.Versions.parseMultipleVersionRange()方法的使用及代码示例

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

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

Versions.parseMultipleVersionRange介绍

[英]Create a version range from a string representation

For example:

  • 1.0 Version 1.0
  • [1.0,2.0) Versions 1.0 (included) to 2.0 (not included)
  • [1.0,2.0] Versions 1.0 to 2.0 (both included)
  • [1.5,) Versions 1.5 and higher
  • (,1.0],[1.2,) Versions up to 1.0 (included) and 1.2 or higher
    [中]从字符串表示创建版本范围
    例如:
    *1.01.0版
    *[1.0,2.0)版本1.0(含)至2.0(不含)
    *[1.0,2.0]版本1.0至2.0(均包含在内)
    *[1.5,)1.5及更高版本
    *(,1.0],[1.2,)高达1.0(含)和1.2或更高版本

代码示例

代码示例来源:origin: org.jboss.forge.furnace/furnace-api

/**
* Create a new {@link AddonDependencyEntry} with the given attributes.
*/
public static AddonDependencyEntry create(String name, String versionRange)
{
 return create(name, Versions.parseMultipleVersionRange(versionRange), false, false);
}

代码示例来源:origin: org.jboss.forge.furnace/furnace-api

/**
* Create a new {@link AddonDependencyEntry} with the given attributes.
*/
public static AddonDependencyEntry create(String name, String versionRange, boolean exported)
{
 return create(name, Versions.parseMultipleVersionRange(versionRange), exported, false);
}

代码示例来源:origin: org.jboss.forge.furnace/furnace-api

/**
* Create a new {@link AddonDependencyEntry} with the given attributes.
*/
public static AddonDependencyEntry create(String name, String versionRange, boolean exported, boolean optional)
{
 return create(name, Versions.parseMultipleVersionRange(versionRange), exported, optional);
}

代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-archives

static CoordinatePattern fromCoordinatePattern(String coordinates)
{
  String[] parts = coordinates.split("\\s*:\\s*");
  if (parts.length < 3)
    throw new IllegalArgumentException("Expected GAV definition format is 'GROUP_ID:ARTIFACT_ID:VERSION_OR_RANGE[:CLASSIFIER]', was: "
          + coordinates);
  CoordinateBuilder coordinate = CoordinateBuilder.create()
        .setGroupId(parts[0])
        .setArtifactId(parts[1]);
  VersionRange version = null;
  if (parts[2].equals("*"))
    version = new EmptyVersionRange();
  //  Range - (1.0,2.0]  or [1.0,2.0) etc.
  else if (parts[2].matches("^(\\[|\\()[^,]+(,[^,]+)?(\\]|\\))$"))
    version = Versions.parseMultipleVersionRange(parts[2]);
  else
    version = new SingleVersionRange(new SingleVersion(parts[2]));
  if (parts.length >= 4)
    coordinate.setClassifier(parts[3]);
  return new CoordinatePattern(coordinate, version);
}

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

static CoordinatePattern fromCoordinatePattern(String coordinates)
{
  String[] parts = coordinates.split("\\s*:\\s*");
  if (parts.length < 3)
    throw new IllegalArgumentException("Expected GAV definition format is 'GROUP_ID:ARTIFACT_ID:VERSION_OR_RANGE[:CLASSIFIER]', was: "
          + coordinates);
  CoordinateBuilder coordinate = CoordinateBuilder.create()
        .setGroupId(parts[0])
        .setArtifactId(parts[1]);
  VersionRange version = null;
  if (parts[2].equals("*"))
    version = new EmptyVersionRange();
  //  Range - (1.0,2.0]  or [1.0,2.0) etc.
  else if (parts[2].matches("^(\\[|\\()[^,]+(,[^,]+)?(\\]|\\))$"))
    version = Versions.parseMultipleVersionRange(parts[2]);
  else
    version = new SingleVersionRange(new SingleVersion(parts[2]));
  if (parts.length >= 4)
    coordinate.setClassifier(parts[3]);
  return new CoordinatePattern(coordinate, version);
}

代码示例来源:origin: org.jboss.windup.rules.apps/rules-java-archives

static CoordinatePattern fromCoordinatePattern(String coordinates)
{
  String[] parts = coordinates.split("\\s*:\\s*");
  if (parts.length < 3)
    throw new IllegalArgumentException("Expected GAV definition format is 'GROUP_ID:ARTIFACT_ID:VERSION_OR_RANGE[:CLASSIFIER]', was: "
          + coordinates);
  CoordinateBuilder coordinate = CoordinateBuilder.create()
        .setGroupId(parts[0])
        .setArtifactId(parts[1]);
  VersionRange version = null;
  if (parts[2].matches("\\*"))
    version = new EmptyVersionRange();
  else if (parts[2].matches("^(\\[|\\()[^,]+(,?[^,]+)+(\\]|\\))$"))
    version = Versions.parseMultipleVersionRange(parts[2]);
  else
    version = new SingleVersionRange(new SingleVersion(parts[2]));
  if (parts.length >= 4)
    coordinate.setClassifier(parts[3]);
  return new CoordinatePattern(coordinate, version);
}

相关文章