aQute.bnd.osgi.Analyzer.getClassspace()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(127)

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

Analyzer.getClassspace介绍

[英]Return the classes for a given source package.
[中]返回给定源包的类。

代码示例

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

/**
 * Return the classes for a given source package.
 * 
 * @param source the source package
 * @return a set of classes for the requested package.
 */
public Set<Clazz> getClassspace(PackageRef source) {
  Set<Clazz> result = new HashSet<>();
  for (Clazz c : getClassspace().values()) {
    if (c.getClassName()
      .getPackageRef() == source)
      result.add(c);
  }
  return result;
}

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

/**
 * Return the classes for a given source package.
 * 
 * @param source
 *            the source package
 * @return a set of classes for the requested package.
 */
public Set<Clazz> getClassspace(PackageRef source) {
  Set<Clazz> result = new HashSet<Clazz>();
  for (Clazz c : getClassspace().values()) {
    if (c.getClassName().getPackageRef() == source)
      result.add(c);
  }
  return result;
}

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

/**
 * Return the classes for a given source package.
 * 
 * @param source
 *            the source package
 * @return a set of classes for the requested package.
 */
public Set<Clazz> getClassspace(PackageRef source) {
  Set<Clazz> result = new HashSet<Clazz>();
  for (Clazz c : getClassspace().values()) {
    if (c.getClassName().getPackageRef() == source)
      result.add(c);
  }
  return result;
}

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

/**
 * Return the classes for a given source package.
 * 
 * @param source the source package
 * @return a set of classes for the requested package.
 */
public Set<Clazz> getClassspace(PackageRef source) {
  Set<Clazz> result = new HashSet<>();
  for (Clazz c : getClassspace().values()) {
    if (c.getClassName()
      .getPackageRef() == source)
      result.add(c);
  }
  return result;
}

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

/**
 * Return the classes for a given source package.
 * 
 * @param source
 *            the source package
 * @return a set of classes for the requested package.
 */
public Set<Clazz> getClassspace(PackageRef source) {
  Set<Clazz> result = new HashSet<Clazz>();
  for (Clazz c : getClassspace().values()) {
    if (c.getClassName().getPackageRef() == source)
      result.add(c);
  }
  return result;
}

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

for (Clazz clazz : analyzer.getClassspace().values()) {
  if (hasOverlap(unresolvedReferences, clazz.getReferred()))
    culprits.add(clazz.getAbsolutePath());

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

private void verifyActivator() throws Exception {
  String bactivator = main.get("Bundle-Activator");
  if (bactivator != null) {
    TypeRef ref = analyzer.getTypeRefFromFQN(bactivator);
    if (analyzer.getClassspace().containsKey(ref))
      return;
    PackageRef packageRef = ref.getPackageRef();
    if (packageRef.isDefaultPackage())
      error("The Bundle Activator is not in the bundle and it is in the default package ");
    else if (!analyzer.isImported(packageRef)) {
      error("Bundle-Activator not found on the bundle class path nor in imports: " + bactivator);
    }
  }
}

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

final MultiMap<Clazz.Def, TypeRef> xref = new MultiMap<>(Clazz.Def.class, TypeRef.class, true);
for (final Clazz clazz : getClassspace().values()) {
  if ((clazz.accessx & sourceModifiers) == 0)
    continue;

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

Set<Clazz> list = new HashSet<Clazz>(analyzer.getClassspace().values());
String sc = analyzer.getProperty(Constants.SERVICE_COMPONENT);
List<String> names = new ArrayList<String>();

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

for (Clazz c : analyzer.getClassspace().values()) {
  if (c.isPublic() || c.isProtected()) {
    PackageRef packageName = c.getClassName().getPackageRef();

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

for (Clazz c : analyzer.getClassspace().values()) {
  if (c.isPublic() || c.isProtected()) {
    PackageRef packageName = c.getClassName().getPackageRef();

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
  Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.DSANNOTATIONS));
  if (header.size() == 0)
    return false;
  Instructions instructions = new Instructions(header);
  Collection<Clazz> list = analyzer.getClassspace().values();
  String sc = analyzer.getProperty(Constants.SERVICE_COMPONENT);
  List<String> names = new ArrayList<String>();
  if (sc != null && sc.trim().length() > 0)
    names.add(sc);
  for (Clazz c: list) {
    for (Instruction instruction : instructions.keySet()) {
      if (instruction.matches(c.getFQN())) {
        if (instruction.isNegated())
          break;
        ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
        if (definition != null) {
          definition.sortReferences();
          definition.prepare(analyzer);
          String name = "OSGI-INF/" + analyzer.validResourcePath(definition.name, "Invalid component name") + ".xml";
          names.add(name);
          analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
        }
      }
    }
  }
  sc = Processor.append(names.toArray(new String[names.size()]));
  analyzer.setProperty(Constants.SERVICE_COMPONENT, sc);
  return false;
}

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

for (Clazz c : analyzer.getClassspace().values()) {
  if (c.isPublic() || c.isProtected()) {
    PackageRef packageName = c.getClassName().getPackageRef();

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
  Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.DSANNOTATIONS));
  if (header.size() == 0)
    return false;
  Instructions instructions = new Instructions(header);
  Collection<Clazz> list = analyzer.getClassspace().values();
  String sc = analyzer.getProperty(Constants.SERVICE_COMPONENT);
  List<String> names = new ArrayList<String>();
  if (sc != null && sc.trim().length() > 0)
    names.add(sc);
  for (Clazz c: list) {
    for (Instruction instruction : instructions.keySet()) {
      if (instruction.matches(c.getFQN())) {
        if (instruction.isNegated())
          break;
        ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
        if (definition != null) {
          definition.sortReferences();
          definition.prepare(analyzer);
          String name = "OSGI-INF/" + analyzer.validResourcePath(definition.name, "Invalid component name") + ".xml";
          names.add(name);
          analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
        }
      }
    }
  }
  sc = Processor.append(names.toArray(new String[names.size()]));
  analyzer.setProperty(Constants.SERVICE_COMPONENT, sc);
  return false;
}

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

for (Clazz c : analyzer.getClassspace()
  .values()) {

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

/**
 * Create a Metatype and Designate record out of the given
 * configurations.
 * 
 * @param name
 * @param config
 */
private boolean designate(String name, String config, boolean factory) {
  if (config == null)
    return false;
  for (String c : Processor.split(config)) {
    TypeRef ref = analyzer.getTypeRefFromFQN(c);
    Clazz clazz = analyzer.getClassspace().get(ref);
    if (clazz != null) {
      analyzer.referTo(ref);
      MetaTypeReader r = new MetaTypeReader(clazz, analyzer);
      r.setDesignate(name, factory);
      String rname = "OSGI-INF/metatype/" + name + ".xml";
      analyzer.getJar().putResource(rname, r);
    } else {
      analyzer.error("Cannot find designated configuration class %s for component %s", c, name);
    }
  }
  return true;
}

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

if (bactivator != null) {
  TypeRef ref = analyzer.getTypeRefFromFQN(bactivator);
  if (analyzer.getClassspace().containsKey(ref)) {
    Clazz activatorClazz = analyzer.getClassspace().get(ref);

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

if (bactivator != null) {
  TypeRef ref = analyzer.getTypeRefFromFQN(bactivator);
  if (analyzer.getClassspace().containsKey(ref)) {
    Clazz activatorClazz = analyzer.getClassspace().get(ref);

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

Collection<Clazz> list = analyzer.getClassspace().values();
list = analyzer.getClassspace().values();

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

Collection<Clazz> list = analyzer.getClassspace().values();
list = analyzer.getClassspace().values();

相关文章

Analyzer类方法