Java2OWL
Class AnnotationReader

Object
  extended by AnnotationReader
All Implemented Interfaces:
AttributeReader

public class AnnotationReader
extends Object
implements AttributeReader

This class implements a reader for user defined annotations. It fills a gap in the BCEL-library.

In contrast to Java reflection, where user defined annotations are accessible as Java objects, BCEL extracts user defined annotations, but does not parse them. This must be done by the AnnotationReader.

This is adapted from an implementation by Don Schwarz.

The annotation reader is installed by calling Attribute.addAttributeReader("RuntimeVisibleAnnotations",new AnnotationReader());


Constructor Summary
AnnotationReader()
           
 
Method Summary
 Attribute createAttribute(int name_index, int length, DataInputStream in, ConstantPool cp)
          This method is called when a class file is parsed by the BCEL-parser.
 Map readAnnotation(DataInputStream in, ConstantPool cp)
          This method reads a single annotation
 Object readMemberValue(DataInputStream in, ConstantPool cp)
          This method reads the value of a key-value pair.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationReader

public AnnotationReader()
Method Detail

createAttribute

public Attribute createAttribute(int name_index,
                                 int length,
                                 DataInputStream in,
                                 ConstantPool cp)
This method is called when a class file is parsed by the BCEL-parser. It parses RuntimeVisibleAnnotations into instances of AnnotationsAttribute.

Specified by:
createAttribute in interface AttributeReader

readAnnotation

public Map readAnnotation(DataInputStream in,
                          ConstantPool cp)
                   throws IOException
This method reads a single annotation

Throws:
IOException

readMemberValue

public Object readMemberValue(DataInputStream in,
                              ConstantPool cp)
                       throws IOException,
                              UnsupportedOperationException
This method reads the value of a key-value pair.

Throws:
IOException
UnsupportedOperationException