org.python.core
Class AnnotationReader

java.lang.Object
  extended by org.objectweb.asm.commons.EmptyVisitor
      extended by org.python.core.AnnotationReader
All Implemented Interfaces:
org.objectweb.asm.AnnotationVisitor, org.objectweb.asm.ClassVisitor, org.objectweb.asm.FieldVisitor, org.objectweb.asm.MethodVisitor

public class AnnotationReader
extends org.objectweb.asm.commons.EmptyVisitor

This class reads a classfile from a byte array and pulls out the value of the class annotation for APIVersion, which can then be retrieved by a call to getVersion(). Hopefully the use of ClassReader in this implementation is not too expensive. I suspect it is not since EmptyVisitor is just a bag of empty methods so shouldn't cost too much. If it turns out to cost too much, we will want to implement a special purpose ClassReader that only reads out the APIVersion annotation I think.


Constructor Summary
AnnotationReader(byte[] data)
          Reads the classfile bytecode in data and to extract the version.
 
Method Summary
 long getMTime()
           
 int getVersion()
           
 void visit(String name, Object value)
           
 org.objectweb.asm.AnnotationVisitor visitAnnotation(String desc, boolean visible)
           
 
Methods inherited from class org.objectweb.asm.commons.EmptyVisitor
visit, visitAnnotation, visitAnnotationDefault, visitArray, visitAttribute, visitCode, visitEnd, visitEnum, visitField, visitFieldInsn, visitFrame, visitIincInsn, visitInnerClass, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethod, visitMethodInsn, visitMultiANewArrayInsn, visitOuterClass, visitParameterAnnotation, visitSource, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationReader

public AnnotationReader(byte[] data)
                 throws IOException
Reads the classfile bytecode in data and to extract the version.

Throws:
IOException - - if the classfile is malformed.
Method Detail

visitAnnotation

public org.objectweb.asm.AnnotationVisitor visitAnnotation(String desc,
                                                           boolean visible)
Specified by:
visitAnnotation in interface org.objectweb.asm.ClassVisitor
Specified by:
visitAnnotation in interface org.objectweb.asm.FieldVisitor
Specified by:
visitAnnotation in interface org.objectweb.asm.MethodVisitor
Overrides:
visitAnnotation in class org.objectweb.asm.commons.EmptyVisitor

visit

public void visit(String name,
                  Object value)
Specified by:
visit in interface org.objectweb.asm.AnnotationVisitor
Overrides:
visit in class org.objectweb.asm.commons.EmptyVisitor

getVersion

public int getVersion()

getMTime

public long getMTime()


Jython homepage