congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Clazz
Code IndexAdd Tabnine to your IDE (free)

How to use
Clazz
in
aQute.bnd.osgi

Best Java code snippets using aQute.bnd.osgi.Clazz (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Analyzer
  • Jar
  • Matcher
  • Pattern
  • DataInputStream
origin: stackoverflow.com

 function Clazz() {};
Clazz.staticMethod = function() {
  alert('STATIC!!!');
};

Clazz.prototype.func = function() {
  this.constructor.staticMethod();
}

var obj = new Clazz();
obj.func(); // <- Alert's "STATIC!!!"
origin: biz.aQute.bnd/bndlib

    analyzer.error(
        "AD for %s.%s uses an array of collections in return type (%s), Metatype allows either Vector or array",
        clazz.getClassName().getFQN(), defined.getName(), defined.getType().getFQN());
  Matcher m = COLLECTION.matcher(rtype);
  if (m.matches()) {
    rtype = Clazz.objectDescriptorToFQN(m.group(3));
    ad.cardinality = Integer.MIN_VALUE;
TypeRef typeRef = analyzer.getTypeRefFromFQN(rtype);
try {
  Clazz c = analyzer.findClass(typeRef);
  if (c != null && c.isEnum()) {
    parseOptionValues(c, ad.options);
  analyzer.error(
      "AD for %s.%s Can not parse option values from type (%s), %s",
      clazz.getClassName().getFQN(), defined.getName(), defined.getType().getFQN(), e.getMessage());
origin: biz.aQute.bnd/bndlib

Analyzer a = new Analyzer();
Clazz clazz = new Clazz(a, "", new URLResource(url));
Map<String,String> d = ComponentAnnotationReader.getDefinition(clazz);
    Matcher matcher = REFERENCE.matcher(key);
    if (matcher.matches()) {
      Reference r = new Reference();
      r.name = matcher.group(1);
      r.set = findMethod(matcher.group(2));
      r.unset = findMethod(matcher.group(3));
origin: apache/felix

Matcher m = Patterns.UPDATED_CONFIG_TYPES.matcher(callbackDescriptor);
List<String> types = new ArrayList<>();
while (m.find()) {
  String type = m.group(5);
  if (type != null) {
    m_logger.debug("checking if type %s is an interface or an annotation", type);
    TypeRef typeRef = m_analyzer.getTypeRef(type);
    try {
      Clazz clazz = m_analyzer.findClass(typeRef);
      if (! clazz.isAnnotation() && ! clazz.isInterface()) {
        m_logger.debug("ignoring updated callback signature %s (argument type not an interface or an annotation", callbackDescriptor);
        continue;
origin: biz.aQute.bnd/biz.aQute.bndlib

private boolean identifiableCollection(TypeRef type, boolean intface, boolean topLevel) {
  try {
    Clazz clazz = analyzer.findClass(type);
    if (clazz != null && (!topLevel || !clazz.isAbstract())
      && ((intface && clazz.isInterface()) ^ clazz.hasPublicNoArgsConstructor())) {
      TypeRef[] intfs = clazz.getInterfaces();
      if (intfs != null) {
        for (TypeRef intf : intfs) {
          if (COLLECTION.matcher(intf.getFQN())
            .matches() || identifiableCollection(intf, true, false)) {
            return true;
          }
        }
      }
      TypeRef ext = clazz.getSuper();
      return ext != null && identifiableCollection(ext, false, false);
    }
  } catch (Exception e) {
    return false;
  }
  return false;
}
origin: biz.aQute.bnd/biz.aQute.bndlib

  if (!PACKAGEPATTERN.matcher(element.trim())
    .matches()) {
    allElementsAreTypes = false;
    break;
if (activatorClazz.isInterface()) {
  registerActivatorErrorLocation(
    error("The Bundle Activator %s is an interface and therefore cannot be instantiated.",
    bactivator, ActivatorErrorType.IS_INTERFACE);
} else {
  if (activatorClazz.isAbstract()) {
    registerActivatorErrorLocation(
      error("The Bundle Activator %s is abstract and therefore cannot be instantiated.",
      bactivator, ActivatorErrorType.IS_ABSTRACT);
  if (!activatorClazz.isPublic()) {
    registerActivatorErrorLocation(
      error("Bundle Activator classes must be public, and %s is not.", bactivator), bactivator,
      ActivatorErrorType.NOT_PUBLIC);
  if (!activatorClazz.hasPublicNoArgsConstructor()) {
    registerActivatorErrorLocation(error(
      "Bundle Activator classes must have a public zero-argument constructor and %s does not.",
  if (!analyzer.assignable(activatorClazz.getFQN(), "org.osgi.framework.BundleActivator")) {
origin: biz.aQute.bnd/biz.aQute.bndlib

  name);
FileLine where = getHeader(Pattern.compile(Constants.SERVICE_COMPONENT),
  Pattern.compile(Pattern.quote(name)));
if (where != null) {
  where.set(warning);
Collection<Clazz> classes = analyzer.getClasses(null, "NAMED", name, "ANNOTATED",
  "aQute.bnd.annotation.component.Component");
    clazz.getFQN());
  TypeRef cname = clazz.getClassName();
  String source = analyzer.getSourceFileFor(cname);
  if (source != null) {
    File f = getFile(source);
origin: biz.aQute/bndlib

/* int max_stack = */in.readUnsignedShort();
/* int max_locals = */in.readUnsignedShort();
int code_length = in.readInt();
byte code[] = new byte[code_length];
in.readFully(code);
crawl(code);
int exception_table_length = in.readUnsignedShort();
in.skipBytes(exception_table_length * 8);
doAttributes(in, ElementType.METHOD, false, 0);
origin: biz.aQute.bnd/bndlib

/* int max_stack = */in.readUnsignedShort();
/* int max_locals = */in.readUnsignedShort();
int code_length = in.readInt();
byte code[] = new byte[code_length];
in.readFully(code);
crawl(code);
int exception_table_length = in.readUnsignedShort();
for (int i = 0; i < exception_table_length; i++) {
  int handler_pc = in.readUnsignedShort();
  int catch_type = in.readUnsignedShort();
  classConstRef(catch_type);
doAttributes(in, ElementType.METHOD, false, 0);
origin: biz.aQute/bndlib

case 'I' : // Integer
case 'S' : // Short
  int const_value_index = in.readUnsignedShort();
  return intPool[const_value_index];
  int type_name_index = in.readUnsignedShort();
  if (policy == RetentionPolicy.RUNTIME) {
    referTo(type_name_index, 0);
    if (api != null && (Modifier.isPublic(access_flags) || Modifier.isProtected(access_flags))) {
      TypeRef name = analyzer.getTypeRef((String) pool[type_name_index]);
      api.add(name.getPackageRef());
  int class_info_index = in.readUnsignedShort();
  if (policy == RetentionPolicy.RUNTIME) {
    referTo(class_info_index, 0);
    if (api != null && (Modifier.isPublic(access_flags) || Modifier.isProtected(access_flags))) {
      TypeRef name = analyzer.getTypeRef((String) pool[class_info_index]);
      api.add(name.getPackageRef());
  return doAnnotation(in, member, policy, collect, access_flags);
  Object[] result = new Object[num_values];
  for (int i = 0; i < num_values; i++) {
    result[i] = doElementValue(in, member, policy, collect, access_flags);
origin: biz.aQute/bndlib

private void doAnnotations(DataInputStream in, ElementType member, RetentionPolicy policy, int access_flags)
    throws IOException {
  int num_annotations = in.readUnsignedShort(); // # of annotations
  for (int a = 0; a < num_annotations; a++) {
    if (cd == null)
      doAnnotation(in, member, policy, false, access_flags);
    else {
      Annotation annotion = doAnnotation(in, member, policy, true, access_flags);
      cd.annotation(annotion);
    }
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

Map<String, Clazz> mismatched = new HashMap<>();
      String relativeDir = relativePath.substring(0, n);
        clazz = new Clazz(this, path, resource);
        clazz.parseClassFile();
      } catch (Throwable e) {
        exception(e, "Invalid class file %s (%s)", relativePath, e);
        continue next;
      String calculatedPath = clazz.getClassName()
        .getPath();
      if (!calculatedPath.equals(relativePath)) {
          mismatched.put(clazz.getAbsolutePath(), clazz);
      } else {
        classspace.put(clazz.getClassName(), clazz);
        PackageRef packageRef = clazz.getClassName()
          .getPackageRef();
        learnPackage(jar, prefix, packageRef, contained);
        for (PackageRef p : clazz.getReferred()) {
          referred.put(p);
          refs.add(p);
        apiUses.addAll(packageRef, clazz.getAPIUses());
origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * Visit each class on the class path.
 * 
 * @param visitor the visitor
 */
public void visit(ClassVisitor visitor) throws Exception {
  try (Analyzer analyzer = new Analyzer()) {
    for (File f : entries) {
      try (Jar jar = new Jar(f)) {
        for (String path : jar.getResources()
          .keySet()) {
          if (path.endsWith(".class")) {
            Resource r = jar.getResource(path);
            Clazz c = new Clazz(analyzer, path, r);
            c.parseClassFile();
            visitor.visit(c);
          }
        }
      }
    }
  }
}
origin: biz.aQute.bnd/bndlib

  return;
Manifest m = analyzer.getJar().getManifest();
if (m == null) {
  error("No manifest");
Set<PackageRef> unresolvedReferences = new TreeSet<PackageRef>(analyzer.getReferred().keySet());
unresolvedReferences.removeAll(analyzer.getContained().keySet());
for ( String pname : domain.getImportPackage().keySet()) {
  PackageRef pref = analyzer.getPackageRef(pname);
    for (Clazz clazz : analyzer.getClassspace().values()) {
      if (hasOverlap(unresolvedReferences, clazz.getReferred()))
        culprits.add(clazz.getAbsolutePath());
origin: biz.aQute.bnd/bndlib

/**
 * Visit each class on the class path.
 * 
 * @param visitor
 *            the visitor
 */
public void visit(ClassVisitor visitor) throws Exception {
  Analyzer analyzer = new Analyzer();
  try {
    for (File f : entries) {
      Jar jar = new Jar(f);
      try {
        for (String path : jar.getResources().keySet()) {
          if (path.endsWith(".class")) {
            Resource r = jar.getResource(path);
            Clazz c = new Clazz(analyzer, path, r);
            c.parseClassFile();
            visitor.visit(c);
          }
        }
      }
      finally {
        jar.close();
      }
    }
  }
  finally {
    analyzer.close();
  }
}
origin: biz.aQute/bndlib

  public boolean analyzeJar(Analyzer analyzer) throws Exception {

    Parameters map = analyzer.parseHeader(analyzer.getProperty(Constants.METATYPE));

    Jar jar = analyzer.getJar();
    for (String name : map.keySet()) {
      Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(), Meta.OCD.class.getName(), //
          QUERY.NAMED.toString(), name //
          );
      for (Clazz c : metatypes) {
        jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer));
      }
    }
    return false;
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

private ComponentDef getDef() throws Exception {
  if (clazz.isEnum() || clazz.isInterface() || clazz.isAnnotation()) {
    if (clazz.is(ANNOTATED, COMPONENT_INSTR, analyzer)) {
      analyzer
        .error("The type %s is not a class and therfore not suitable for the @Component annotation",
          clazz.getFQN())
        .details(
          new DeclarativeServicesAnnotationError(clazz.getFQN(), null, ErrorType.INVALID_COMPONENT_TYPE));
  if (!clazz.is(ANNOTATED, COMPONENT_INSTR, analyzer)) {
  clazz.parseClassFileWithCollector(this);
  if (component.implementation == null)
    return null;
        break;
      Clazz ec = analyzer.findClass(extendsClass);
      if (ec == null) {
        analyzer
          .error("Missing super class for DS annotations: %s from %s", extendsClass, clazz.getClassName())
          .details(new DeclarativeServicesAnnotationError(className.getFQN(), null, null,
            ErrorType.UNABLE_TO_LOCATE_SUPER_CLASS));
        break;
      } else {
        ec.parseClassFileWithCollector(this);
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/biz.aQute.bndlib

private List<BeanDef> getDefs() throws Exception {
  if (clazz.isEnum() || clazz.isInterface() || clazz.isAnnotation()) {
  if (options.contains(Discover.all) && !clazz.is(QUERY.CONCRETE, null, analyzer)) {
    return null;
    if (clazz.is(QUERY.ANNOTATED, VETOED_INSTR, analyzer)
      || (!clazz.is(QUERY.INDIRECTLY_ANNOTATED, COMPONENTSCOPED_INSTR, analyzer)
        && !clazz.is(QUERY.INDIRECTLY_ANNOTATED, NORMALSCOPE_INSTR, analyzer)
        && !clazz.is(QUERY.INDIRECTLY_ANNOTATED, STEREOTYPE_INSTR, analyzer)
        && !clazz.is(QUERY.ANNOTATED, DEPENDENT_INSTR, analyzer)
        && !clazz.is(QUERY.ANNOTATED, INTERCEPTOR_INSTR, analyzer))
      || clazz.is(QUERY.IMPLEMENTS, EXTENSION_INSTR, analyzer)) {
    Clazz packageClazz = analyzer.getPackageInfo(clazz.getClassName()
      .getPackageRef());
    if (packageClazz != null && packageClazz.is(QUERY.ANNOTATED, VETOED_INSTR, analyzer)) {
      return null;
  clazz.parseClassFileWithCollector(this);
origin: biz.aQute.bnd/biz.aQute.bndlib

TypeRef typeRef = analyzer.getTypeRef(param.binary);
try {
  Clazz clazz = analyzer.findClass(typeRef);
  if (clazz.isAnnotation()) {
    component.updateVersion(V1_3);
    clazz.parseClassFileWithCollector(
      new ComponentPropertyTypeDataCollector(propertyDefKey, memberDescriptor, details));
  } else if (clazz.isInterface() && options.contains(Options.felixExtensions)) {
    component.updateVersion(V1_3);
  } else {
    analyzer
      .error("Non annotation type for activation object with descriptor %s, type %s",
        memberDescriptor, param.binary)
      .details(details);
aQute.bnd.osgiClazz

Most used methods

  • <init>
  • parseClassFileWithCollector
  • getClassName
  • getFQN
  • getReferred
  • is
  • isAnnotation
  • isInterface
  • crawl
    We must find Class.forName references ...
  • doAnnotation
  • doAnnotations
  • doAttribute
    Process a single attribute, if not recognized, skip it.
  • doAnnotations,
  • doAttribute,
  • doAttributes,
  • doCode,
  • doConstantValue,
  • doElementValue,
  • doEnclosingMethod,
  • doExceptions,
  • doInnerClasses,
  • doParameterAnnotations

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • startActivity (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now