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

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

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

Analyzer.findClass介绍

[英]Find a clazz on the class path. This class has been parsed.
[中]在类路径上查找clazz。该类已被解析。

代码示例

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

@Override
public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
  throws Exception {
  Clazz clazz = analyzer.findClass(innerClass);
  if (clazz != null)
    clazz.setInnerAccess(innerClassAccessFlags);
  if (Modifier.isProtected(innerClassAccessFlags) || Modifier.isPublic(innerClassAccessFlags))
    return;
  notAccessible.add(innerClass);
}

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

public Clazz getPackageInfo(PackageRef packageRef) {
  TypeRef tr = descriptors.getPackageInfo(packageRef);
  try {
    return findClass(tr);
  } catch (Exception e) {
    return null;
  }
}

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

private boolean isProvider(TypeRef t) throws Exception {
  Clazz c = findClass(t);
  if (c == null)
    return false;
  if (c.annotations == null)
    return false;
  TypeRef pt = getTypeRefFromFQN(ProviderType.class.getName());
  boolean result = c.annotations.contains(pt);
  return result;
}

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

@Override
public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
    throws Exception {
  Clazz clazz = analyzer.findClass(innerClass);
  if (clazz != null)
    clazz.setInnerAccess(innerClassAccessFlags);
  if (Modifier.isProtected(innerClassAccessFlags) || Modifier.isPublic(innerClassAccessFlags))
    return;
  notAccessible.add(innerClass);
}

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

@Override
public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
    throws Exception {
  Clazz clazz = analyzer.findClass(innerClass);
  if (clazz != null)
    clazz.setInnerAccess(innerClassAccessFlags);
  if (Modifier.isProtected(innerClassAccessFlags) || Modifier.isPublic(innerClassAccessFlags))
    return;
  notAccessible.add(innerClass);
}

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

public Clazz getPackageInfo(PackageRef packageRef) {
  TypeRef tr = descriptors.getPackageInfo(packageRef);
  try {
    return findClass(tr);
  } catch (Exception e) {
    return null;
  }
}

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

@Override
public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
  throws Exception {
  Clazz clazz = analyzer.findClass(innerClass);
  if (clazz != null)
    clazz.setInnerAccess(innerClassAccessFlags);
  if (Modifier.isProtected(innerClassAccessFlags) || Modifier.isPublic(innerClassAccessFlags))
    return;
  notAccessible.add(innerClass);
}

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

@Override
public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
    throws Exception {
  Clazz clazz = analyzer.findClass(innerClass);
  if (clazz != null)
    clazz.setInnerAccess(innerClassAccessFlags);
  if (Modifier.isProtected(innerClassAccessFlags) || Modifier.isPublic(innerClassAccessFlags))
    return;
  notAccessible.add(innerClass);
}

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

public boolean assignable(String annoService, String inferredService) {
  if (annoService == null || annoService.isEmpty() || inferredService == null || inferredService.isEmpty()
    || Object.class.getName()
      .equals(inferredService))
    return true;
  try {
    Clazz annoServiceClazz = findClass(getTypeRefFromFQN(annoService));
    Clazz inferredServiceClazz = findClass(getTypeRefFromFQN(inferredService));
    return assignable(annoServiceClazz, inferredServiceClazz);
  } catch (Exception e) {}
  // we couldn't determine
  return true;
}

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

public boolean assignable(String annoService, String inferredService) {
  if (annoService == null || annoService.isEmpty() || inferredService == null || inferredService.isEmpty()
    || Object.class.getName()
      .equals(inferredService))
    return true;
  try {
    Clazz annoServiceClazz = findClass(getTypeRefFromFQN(annoService));
    Clazz inferredServiceClazz = findClass(getTypeRefFromFQN(inferredService));
    return assignable(annoServiceClazz, inferredServiceClazz);
  } catch (Exception e) {}
  // we couldn't determine
  return true;
}

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

private boolean isProvider(TypeRef t) throws Exception {
  Clazz c = findClass(t);
  if (c == null)
    return false;
  if (c.annotations == null)
    return false;
  TypeRef pt = getTypeRefFromFQN(ProviderType.class.getName());
  TypeRef r6pt = getTypeRefFromFQN("org.osgi.annotation.versioning.ProviderType");
  boolean result = c.annotations.contains(pt) || c.annotations.contains(r6pt);
  return result;
}

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

private boolean isProvider(TypeRef t) throws Exception {
  Clazz c = findClass(t);
  if (c == null)
    return false;
  if (c.annotations == null)
    return false;
  TypeRef pt = getTypeRefFromFQN(ProviderType.class.getName());
  TypeRef r6pt = getTypeRefFromFQN("org.osgi.annotation.versioning.ProviderType");
  boolean result = c.annotations.contains(pt) || c.annotations.contains(r6pt);
  return result;
}

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

public synchronized XMLAttribute getXMLAttribute(Annotation a) throws Exception {
  TypeRef name = a.getName();
  if (annoCache.containsKey(name))
    return annoCache.get(name);
  Clazz clazz = analyzer.findClass(name);
  if (clazz != null) {
    xmlAttr = null;
    clazz.parseClassFileWithCollector(this);
    annoCache.put(name, xmlAttr);
    return xmlAttr;
  }
  return null;
}

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

private boolean isProvider(TypeRef t) {
  Clazz c;
  try {
    c = findClass(t);
  } catch (Exception e) {
    return false;
  }
  if (c == null)
    return false;
  TypeRef providerType = getTypeRef("org/osgi/annotation/versioning/ProviderType");
  return c.annotations()
    .contains(providerType);
}

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

private boolean isProvider(TypeRef t) {
  Clazz c;
  try {
    c = findClass(t);
  } catch (Exception e) {
    return false;
  }
  if (c == null)
    return false;
  TypeRef providerType = getTypeRef("org/osgi/annotation/versioning/ProviderType");
  return c.annotations()
    .contains(providerType);
}

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

@Override
public void extendsClass(TypeRef name) throws Exception {
  String comment = null;
  if (!clazz.isInterface())
    comment = inherit(members, name);
  Clazz c = analyzer.findClass(name);
  if ((c == null || c.isPublic()) && !name.isObject())
    members.add(new Element(EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
}

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

@Override
public void extendsClass(TypeRef name) throws Exception {
  String comment = null;
  if (!clazz.isInterface())
    comment = inherit(members, name);
  Clazz c = analyzer.findClass(name);
  if ((c == null || c.isPublic()) && !name.isObject())
    members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
}

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

@Override
public void extendsClass(TypeRef name) throws Exception {
  String comment = null;
  if (!clazz.isInterface())
    comment = inherit(members, name);
  Clazz c = analyzer.findClass(name);
  if ((c == null || c.isPublic()) && !name.isObject())
    members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
}

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

@Override
public void extendsClass(TypeRef name) throws Exception {
  String comment = null;
  if (!clazz.isInterface())
    comment = inherit(members, name);
  Clazz c = analyzer.findClass(name);
  if ((c == null || c.isPublic()) && !name.isObject())
    members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
}

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

@Override
public void extendsClass(TypeRef name) throws Exception {
  String comment = null;
  if (!clazz.isInterface())
    comment = inherit(members, name);
  Clazz c = analyzer.findClass(name);
  if ((c == null || c.isPublic()) && !name.isObject())
    members.add(new Element(EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
}

相关文章

Analyzer类方法