org.apache.felix.dm.annotation.plugin.bnd
Class AnnotationCollector

java.lang.Object
  extended by aQute.lib.osgi.ClassDataCollector
      extended by org.apache.felix.dm.annotation.plugin.bnd.AnnotationCollector

public class AnnotationCollector
extends aQute.lib.osgi.ClassDataCollector

This is the scanner which does all the annotation parsing on a given class. To start the parsing, just invoke the parseClassFileWithCollector and finish methods. Once parsed, the corresponding component descriptors can be built using the "writeTo" method.


Constructor Summary
AnnotationCollector(aQute.libg.reporter.Reporter reporter, MetaType metaType)
          Makes a new Collector for parsing a given class.
 
Method Summary
 void annotation(aQute.lib.osgi.Annotation annotation)
          An annotation has been parsed.
 void classBegin(int access, String name)
          Parses the name of the class.
 void field(int access, String name, String descriptor)
          Parses a field.
 boolean finish()
          Finishes up the class parsing.
 aQute.libg.reporter.Reporter getReporter()
          Returns the log reporter.
 void implementsInterfaces(String[] interfaces)
          Parses the implemented interfaces ("/" separated).
 void method(int access, String name, String descriptor)
          Parses a method.
 void writeTo(PrintWriter pw)
          Writes the generated component descriptor in the given print writer.
 
Methods inherited from class aQute.lib.osgi.ClassDataCollector
addReference, classEnd, classStart, constant, constructor, enclosingMethod, extendsClass, field, innerClass, method, parameter, reference, reference, signature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationCollector

public AnnotationCollector(aQute.libg.reporter.Reporter reporter,
                           MetaType metaType)
Makes a new Collector for parsing a given class.

Parameters:
reporter - the object used to report logs.
Method Detail

getReporter

public aQute.libg.reporter.Reporter getReporter()
Returns the log reporter.

Returns:
the log reporter.

classBegin

public void classBegin(int access,
                       String name)
Parses the name of the class.

Overrides:
classBegin in class aQute.lib.osgi.ClassDataCollector
Parameters:
access - the class access
name - the class name (package are "/" separated).

implementsInterfaces

public void implementsInterfaces(String[] interfaces)
Parses the implemented interfaces ("/" separated).

Overrides:
implementsInterfaces in class aQute.lib.osgi.ClassDataCollector

method

public void method(int access,
                   String name,
                   String descriptor)
Parses a method. Always invoked BEFORE eventual method annotation.

Overrides:
method in class aQute.lib.osgi.ClassDataCollector

field

public void field(int access,
                  String name,
                  String descriptor)
Parses a field. Always invoked BEFORE eventual field annotation

Overrides:
field in class aQute.lib.osgi.ClassDataCollector

annotation

public void annotation(aQute.lib.osgi.Annotation annotation)
An annotation has been parsed. Always invoked AFTER the "method"/"field"/"classBegin" callbacks.

Overrides:
annotation in class aQute.lib.osgi.ClassDataCollector

finish

public boolean finish()
Finishes up the class parsing. This method must be called once the parseClassFileWithCollector method has returned.

Returns:
true if some annotations have been parsed, false if not.

writeTo

public void writeTo(PrintWriter pw)
Writes the generated component descriptor in the given print writer. The first line must be the service (@Service or AspectService).

Parameters:
pw - the writer where the component descriptor will be written.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.