aQute.bnd.version.Version.parseVersion()方法的使用及代码示例

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

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

Version.parseVersion介绍

暂无

代码示例

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

private Version getVersion(Map<String, String> map) {
  if (map == null)
    return Version.LOWEST;
  return Version.parseVersion(map.get(Constants.VERSION_ATTRIBUTE));
}

代码示例来源:origin: biz.aQute/bndlib

private Version getVersion(Map<String,String> map) {
  if (map == null)
    return Version.LOWEST;
  return Version.parseVersion(map.get(Constants.VERSION_ATTRIBUTE));
}

代码示例来源:origin: biz.aQute.bnd/bndlib

private Version getVersion(Map<String,String> map) {
  if (map == null)
    return Version.LOWEST;
  return Version.parseVersion(map.get(Constants.VERSION_ATTRIBUTE));
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private Version getVersion(Map<String, String> map) {
  if (map == null)
    return Version.LOWEST;
  return Version.parseVersion(map.get(Constants.VERSION_ATTRIBUTE));
}

代码示例来源:origin: biz.aQute.bnd/bnd

private Version getVersion(Map<String,String> map) {
  if (map == null)
    return Version.LOWEST;
  return Version.parseVersion(map.get(Constants.VERSION_ATTRIBUTE));
}

代码示例来源:origin: biz.aQute.bnd/bnd

Version getPackageInfoVersion(String packageName) throws IOException {
  File packageInfoFile = getPackageInfoFile(packageName);
  if (!packageInfoFile.exists()) {
    return null;
  }
  BufferedReader reader = IO.reader(packageInfoFile);
  try {
    String line;
    while ((line = reader.readLine()) != null) {
      line = line.trim();
      if (line.startsWith("version ")) {
        return Version.parseVersion(line.substring(8));
      }
    }
  }
  finally {
    IO.close(reader);
  }
  return null;
}

代码示例来源:origin: biz.aQute.bnd/bndlib

Version getPackageInfoJavaVersion(String packageName) throws IOException {
  File packageInfoJavaFile = getPackageInfoJavaFile(packageName);
  if (!packageInfoJavaFile.exists()) {
    return null;
  }
  BufferedReader reader = null;
  reader = IO.reader(packageInfoJavaFile);
  try {
    String line;
    while ((line = reader.readLine()) != null) {
      Matcher matcher = VERSION_ANNOTATION.matcher(line);
      if (matcher.find()) {
        return Version.parseVersion(matcher.group(3));
      }
    }
  }
  finally {
    IO.close(reader);
  }
  return null;
}

代码示例来源:origin: biz.aQute/bndlib

private Version getVersion(Tree top) {
  Tree manifest = top.get("<manifest>");
  if (manifest == null) {
    return Version.emptyVersion;
  }
  for (Tree tree : manifest.getChildren()) {
    if (tree.getName().startsWith(Constants.BUNDLE_VERSION)) {
      return Version.parseVersion(tree.getName().substring(15));
    }
  }
  return Version.emptyVersion;
}

代码示例来源:origin: biz.aQute.bnd/bndlib

private Version getVersion(Tree top) {
  Tree manifest = top.get("<manifest>");
  if (manifest == null) {
    return Version.emptyVersion;
  }
  for (Tree tree : manifest.getChildren()) {
    if (tree.getName().startsWith(Constants.BUNDLE_VERSION)) {
      return Version.parseVersion(tree.getName().substring(15));
    }
  }
  return Version.emptyVersion;
}

代码示例来源:origin: biz.aQute.bnd/bnd

private Version getVersion(Tree top) {
  Tree manifest = top.get("<manifest>");
  if (manifest == null) {
    return Version.emptyVersion;
  }
  for (Tree tree : manifest.getChildren()) {
    if (tree.getName().startsWith(Constants.BUNDLE_VERSION)) {
      return Version.parseVersion(tree.getName().substring(15));
    }
  }
  return Version.emptyVersion;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

private Version getVersion(Tree top) {
  Tree manifest = top.get("<manifest>");
  if (manifest == null) {
    return Version.emptyVersion;
  }
  for (Tree tree : manifest.getChildren()) {
    if (tree.getName()
      .startsWith(Constants.BUNDLE_VERSION)) {
      return Version.parseVersion(tree.getName()
        .substring(15));
    }
  }
  return Version.emptyVersion;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private Version getVersion(Tree top) {
  Tree manifest = top.get("<manifest>");
  if (manifest == null) {
    return Version.emptyVersion;
  }
  for (Tree tree : manifest.getChildren()) {
    if (tree.getName()
      .startsWith(Constants.BUNDLE_VERSION)) {
      return Version.parseVersion(tree.getName()
        .substring(15));
    }
  }
  return Version.emptyVersion;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public static final Version getVersion(Capability cap) {
  String attr = getVersionAttributeForNamespace(cap.getNamespace());
  if (attr == null)
    return null;
  Object v = cap.getAttributes()
    .get(attr);
  if (v == null)
    return null;
  if (v instanceof Version)
    return (Version) v;
  if (v instanceof org.osgi.framework.Version)
    return new Version(v.toString());
  if (v instanceof String)
    return Version.parseVersion((String) v);
  return null;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public String _version(String args[]) {
  verifyCommand(args, _versionHelp, null, 2, 3);
  String mask = args[1];
  Version version = null;
  if (args.length >= 3) {
    if (isLocalTarget(args[2]))
      return LITERALVALUE;
    version = Version.parseVersion(args[2]);
  }
  return version(version, mask);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

public String _version(String args[]) {
  verifyCommand(args, _versionHelp, null, 2, 3);
  String mask = args[1];
  Version version = null;
  if (args.length >= 3) {
    if (isLocalTarget(args[2]))
      return LITERALVALUE;
    version = Version.parseVersion(args[2]);
  }
  return version(version, mask);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

public static final Version getVersion(Capability cap) {
  String attr = getVersionAttributeForNamespace(cap.getNamespace());
  if (attr == null)
    return null;
  Object v = cap.getAttributes()
    .get(attr);
  if (v == null)
    return null;
  if (v instanceof Version)
    return (Version) v;
  if (v instanceof org.osgi.framework.Version)
    return new Version(v.toString());
  if (v instanceof String)
    return Version.parseVersion((String) v);
  return null;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

static Expression make(String key, SimpleExpression low, SimpleExpression high) {
  if (key.contains("version")) {
    try {
      Version a = Version.parseVersion(low.value);
      Version b = Version.parseVersion(high.value);
      if (a.compareTo(b) > 0)
        return FALSE;
      if (a.equals(Version.LOWEST) && b.equals(Version.HIGHEST))
        return TRUE;
      if (b.equals(Version.HIGHEST))
        return low;
      if (a.equals(Version.LOWEST))
        return high;
    } catch (Exception e) {
      // ignore, might not be a version
    }
  }
  return new RangeExpression(key, low, high);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

static Expression make(String key, SimpleExpression low, SimpleExpression high) {
  if (key.contains("version")) {
    try {
      Version a = Version.parseVersion(low.value);
      Version b = Version.parseVersion(high.value);
      if (a.compareTo(b) > 0)
        return FALSE;
      if (a.equals(Version.LOWEST) && b.equals(Version.HIGHEST))
        return TRUE;
      if (b.equals(Version.HIGHEST))
        return low;
      if (a.equals(Version.LOWEST))
        return high;
    } catch (Exception e) {
      // ignore, might not be a version
    }
  }
  return new RangeExpression(key, low, high);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

private void directivesAndVersion(Attrs attrs, String... directives) {
  for (String directive : directives) {
    String s = attrs.remove(directive);
    if (s != null) {
      attrs.put(directive + ":", s);
    }
  }
  String remove = attrs.remove(Constants.VERSION_ATTRIBUTE);
  if (remove != null) {
    attrs.putTyped("version", Version.parseVersion(remove));
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private void directivesAndVersion(Attrs attrs, String... directives) {
  for (String directive : directives) {
    String s = attrs.remove(directive);
    if (s != null) {
      attrs.put(directive + ":", s);
    }
  }
  String remove = attrs.remove(Constants.VERSION_ATTRIBUTE);
  if (remove != null) {
    attrs.putTyped("version", Version.parseVersion(remove));
  }
}

相关文章