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

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

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

Version.toStringWithoutQualifier介绍

暂无

代码示例

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

protected File getLocal(String bsn, Version version, Map<String, String> properties) {
  File dir = new File(root, bsn);
  if (LATEST_VERSION.equals(version)) {
    File fjar = new File(dir, bsn + LATEST_POSTFIX);
    if (fjar.isFile())
      return fjar.getAbsoluteFile();
  }
  File fjar = new File(dir, bsn + "-" + version.toStringWithoutQualifier() + ".jar");
  if (fjar.isFile())
    return fjar.getAbsoluteFile();
  File sfjar = new File(dir, version.toStringWithoutQualifier() + ".jar");
  if (sfjar.isFile())
    return sfjar.getAbsoluteFile();
  File flib = new File(dir, bsn + "-" + version.toStringWithoutQualifier() + ".lib");
  if (flib.isFile())
    return flib.getAbsoluteFile();
  File sflib = new File(dir, version.toStringWithoutQualifier() + ".lib");
  if (sflib.isFile())
    return sflib.getAbsoluteFile();
  return fjar.getAbsoluteFile();
}

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

protected File getLocal(String bsn, Version version, Map<String, String> properties) {
  File dir = new File(root, bsn);
  if (LATEST_VERSION.equals(version)) {
    File fjar = new File(dir, bsn + LATEST_POSTFIX);
    if (fjar.isFile())
      return fjar.getAbsoluteFile();
  }
  File fjar = new File(dir, bsn + "-" + version.toStringWithoutQualifier() + ".jar");
  if (fjar.isFile())
    return fjar.getAbsoluteFile();
  File sfjar = new File(dir, version.toStringWithoutQualifier() + ".jar");
  if (sfjar.isFile())
    return sfjar.getAbsoluteFile();
  File flib = new File(dir, bsn + "-" + version.toStringWithoutQualifier() + ".lib");
  if (flib.isFile())
    return flib.getAbsoluteFile();
  File sflib = new File(dir, version.toStringWithoutQualifier() + ".lib");
  if (sflib.isFile())
    return sflib.getAbsoluteFile();
  return fjar.getAbsoluteFile();
}

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

public MavenVersion(Version osgiVersion) {
  this.version = osgiVersion;
  String q = osgiVersion.qualifier;
  this.qualifier = ComparableVersion.parseVersion(q);
  String l = osgiVersion.toStringWithoutQualifier();
  if (q != null) {
    l += "-" + q;
  }
  this.literal = l;
  this.snapshot = osgiVersion.isSnapshot();
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

public MavenVersion(Version osgiVersion) {
  this.version = osgiVersion;
  String q = osgiVersion.qualifier;
  this.qualifier = ComparableVersion.parseVersion(q);
  String l = osgiVersion.toStringWithoutQualifier();
  if (q != null) {
    l += "-" + q;
  }
  this.literal = l;
  this.snapshot = osgiVersion.isSnapshot();
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

public MavenVersion(Version osgiVersion) {
  this.version = osgiVersion;
  String q = osgiVersion.qualifier;
  this.qualifier = ComparableVersion.parseVersion(q);
  String l = osgiVersion.toStringWithoutQualifier();
  if (q != null) {
    l += "-" + q;
  }
  this.literal = l;
  this.snapshot = osgiVersion.isSnapshot();
}

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

public MavenVersion(Version osgiVersion) {
  this.version = osgiVersion;
  String q = osgiVersion.qualifier;
  this.qualifier = ComparableVersion.parseVersion(q);
  String l = osgiVersion.toStringWithoutQualifier();
  if (q != null) {
    l += "-" + q;
  }
  this.literal = l;
  this.snapshot = osgiVersion.isSnapshot();
}

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

public byte[] getTimelessDigest() throws Exception {
  check();
  MessageDigest md = MessageDigest.getInstance("SHA1");
  OutputStream dout = new DigestOutputStream(IO.nullStream, md);
  // dout = System.out;
  Manifest m = getManifest();
  if (m != null) {
    Manifest m2 = new Manifest(m);
    Attributes main = m2.getMainAttributes();
    String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
    String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
    if (version != null && Verifier.isVersion(version)) {
      Version v = new Version(version);
      main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier());
    }
    writeManifest(m2, dout);
    for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
      String path = entry.getKey();
      if (path.equals(manifestName))
        continue;
      Resource resource = entry.getValue();
      dout.write(path.getBytes(UTF_8));
      resource.write(dout);
    }
  }
  return md.digest();
}

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

public byte[] getTimelessDigest() throws Exception {
  check();
  MessageDigest md = MessageDigest.getInstance("SHA1");
  OutputStream dout = new DigestOutputStream(IO.nullStream, md);
  // dout = System.out;
  Manifest m = getManifest();
  if (m != null) {
    Manifest m2 = new Manifest(m);
    Attributes main = m2.getMainAttributes();
    String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
    String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
    if (version != null && Verifier.isVersion(version)) {
      Version v = new Version(version);
      main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier());
    }
    writeManifest(m2, dout);
    for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
      String path = entry.getKey();
      if (path.equals(manifestName))
        continue;
      Resource resource = entry.getValue();
      dout.write(path.getBytes(UTF_8));
      resource.write(dout);
    }
  }
  return md.digest();
}

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

private Element getLocalAPI() throws Exception {
  Set<Element> result = new HashSet<>();
  for (Map.Entry<PackageRef, List<Element>> entry : packages.entrySet()) {
    List<Element> set = entry.getValue();
    set.removeIf(element -> notAccessible.contains(analyzer.getTypeRefFromFQN(element.getName())));
    String version = exports.get(entry.getKey())
      .get(Constants.VERSION_ATTRIBUTE);
    if (version != null) {
      Version v = new Version(version);
      set.add(new Element(VERSION, v.toStringWithoutQualifier(), null, IGNORED, IGNORED, null));
    }
    Element pd = new Element(PACKAGE, entry.getKey()
      .getFQN(), set, MINOR, MAJOR, null);
    result.add(pd);
  }
  for (JAVA java : javas) {
    result.add(new Element(CLASS_VERSION, java.toString(), null, CHANGED, CHANGED, null));
  }
  return new Element(API, "<api>", result, CHANGED, CHANGED, null);
}

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

private Element getLocalAPI() throws Exception {
  Set<Element> result = new HashSet<>();
  for (Map.Entry<PackageRef, List<Element>> entry : packages.entrySet()) {
    List<Element> set = entry.getValue();
    set.removeIf(element -> notAccessible.contains(analyzer.getTypeRefFromFQN(element.getName())));
    String version = exports.get(entry.getKey())
      .get(Constants.VERSION_ATTRIBUTE);
    if (version != null) {
      Version v = new Version(version);
      set.add(new Element(VERSION, v.toStringWithoutQualifier(), null, IGNORED, IGNORED, null));
    }
    Element pd = new Element(PACKAGE, entry.getKey()
      .getFQN(), set, MINOR, MAJOR, null);
    result.add(pd);
  }
  for (JAVA java : javas) {
    result.add(new Element(CLASS_VERSION, java.toString(), null, CHANGED, CHANGED, null));
  }
  return new Element(API, "<api>", result, CHANGED, CHANGED, null);
}

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

String v = new Version(value).toStringWithoutQualifier();
  result.add(new Element(Type.HEADER, header + ":" + v, null, CHANGED, CHANGED, null));
} else {

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

String v = new Version(value).toStringWithoutQualifier();
  result.add(new Element(Type.HEADER, header + ":" + v, null, CHANGED, CHANGED, null));
} else {

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

throw new IOException("Could not create directory " + dir);
String fName = bsn + "-" + version.toStringWithoutQualifier() + ".jar";
File file = new File(dir, fName);
  index.put(bsn + "-" + version.toStringWithoutQualifier(),
    buildDescriptor(tmpFile, tmpJar, digest, bsn, version));

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

throw new IOException("Could not create directory " + dir);
String fName = bsn + "-" + version.toStringWithoutQualifier() + ".jar";
File file = new File(dir, fName);
  index.put(bsn + "-" + version.toStringWithoutQualifier(),
    buildDescriptor(tmpFile, tmpJar, digest, bsn, version));

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

String version = getBundleVersion();
Version v = Version.parseVersion(version);
String outputName = bsn + "-" + v.toStringWithoutQualifier() + Constants.DEFAULT_JAR_EXTENSION;
return new File(outputDir, outputName);

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

String version = getBundleVersion();
Version v = Version.parseVersion(version);
String outputName = bsn + "-" + v.toStringWithoutQualifier() + Constants.DEFAULT_JAR_EXTENSION;
return new File(outputDir, outputName);

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

public void cleanupVersion(Packages packages, String defaultVersion) {
  if (defaultVersion != null) {
    Matcher m = Verifier.VERSION.matcher(defaultVersion);
    if (m.matches()) {
      // Strip qualifier from default package version
      defaultVersion = Version.parseVersion(defaultVersion)
        .toStringWithoutQualifier();
    }
  }
  for (Map.Entry<PackageRef, Attrs> entry : packages.entrySet()) {
    Attrs attributes = entry.getValue();
    String v = attributes.get(Constants.VERSION_ATTRIBUTE);
    if (v == null && defaultVersion != null) {
      if (!isTrue(getProperty(Constants.NODEFAULTVERSION))) {
        v = defaultVersion;
        if (isPedantic())
          warning("Used bundle version %s for exported package %s", v, entry.getKey());
      } else {
        if (isPedantic())
          warning("No export version for exported package %s", entry.getKey());
      }
    }
    if (v != null)
      attributes.put(Constants.VERSION_ATTRIBUTE, cleanupVersion(v));
  }
}

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

public void cleanupVersion(Packages packages, String defaultVersion) {
  if (defaultVersion != null) {
    Matcher m = Verifier.VERSION.matcher(defaultVersion);
    if (m.matches()) {
      // Strip qualifier from default package version
      defaultVersion = Version.parseVersion(defaultVersion)
        .toStringWithoutQualifier();
    }
  }
  for (Map.Entry<PackageRef, Attrs> entry : packages.entrySet()) {
    Attrs attributes = entry.getValue();
    String v = attributes.get(Constants.VERSION_ATTRIBUTE);
    if (v == null && defaultVersion != null) {
      if (!isTrue(getProperty(Constants.NODEFAULTVERSION))) {
        v = defaultVersion;
        if (isPedantic())
          warning("Used bundle version %s for exported package %s", v, entry.getKey());
      } else {
        if (isPedantic())
          warning("No export version for exported package %s", entry.getKey());
      }
    }
    if (v != null)
      attributes.put(Constants.VERSION_ATTRIBUTE, cleanupVersion(v));
  }
}

相关文章