org.eclipse.osgi.service.resolver.State.addDynamicImportPackages()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(118)

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

State.addDynamicImportPackages介绍

[英]Adds the specified dynamic imports to the specified importingBundle. The added dynamic imports are only valid for the instance of this state and will be forgotten if this state is read from a persistent cache.
[中]将指定的动态导入添加到指定的importingBundle。添加的动态导入仅对该状态的实例有效,如果从持久缓存读取该状态,则将被忽略。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.osgi

/**
 * Adds a list of DynamicImport-Package manifest elements to the dynamic
 * import tables of this BundleLoader.  Duplicate packages are checked and
 * not added again.
 * @param packages the DynamicImport-Package elements to add.
 */
public final synchronized void addDynamicImportPackage(ManifestElement[] packages) {
  if (packages == null)
    return;
  List<String> dynamicImports = new ArrayList<String>(packages.length);
  List<ImportPackageSpecification> dynamicImportSpecs = new ArrayList<ImportPackageSpecification>(packages.length);
  for (ManifestElement dynamicImportElement : packages) {
    String[] names = dynamicImportElement.getValueComponents();
    for (String name : names)
      dynamicImports.add(name);
    StateBuilder.addImportPackages(dynamicImportElement, dynamicImportSpecs, 2, true);
  }
  if (dynamicImports.size() > 0) {
    addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
    BundleDescription revision = getLoaderProxy().getBundleDescription();
    State state = revision.getContainingState();
    state.addDynamicImportPackages(revision, dynamicImportSpecs.toArray(new ImportPackageSpecification[dynamicImportSpecs.size()]));
  }
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

/**
 * Adds a list of DynamicImport-Package manifest elements to the dynamic
 * import tables of this BundleLoader.  Duplicate packages are checked and
 * not added again.
 * @param packages the DynamicImport-Package elements to add.
 */
public final synchronized void addDynamicImportPackage(ManifestElement[] packages) {
  if (packages == null)
    return;
  List<String> dynamicImports = new ArrayList<String>(packages.length);
  List<ImportPackageSpecification> dynamicImportSpecs = new ArrayList<ImportPackageSpecification>(packages.length);
  for (ManifestElement dynamicImportElement : packages) {
    String[] names = dynamicImportElement.getValueComponents();
    for (String name : names)
      dynamicImports.add(name);
    StateBuilder.addImportPackages(dynamicImportElement, dynamicImportSpecs, 2, true);
  }
  if (dynamicImports.size() > 0) {
    addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
    BundleDescription revision = getLoaderProxy().getBundleDescription();
    State state = revision.getContainingState();
    state.addDynamicImportPackages(revision, dynamicImportSpecs.toArray(new ImportPackageSpecification[dynamicImportSpecs.size()]));
  }
}

相关文章