jodd.proxetta.asm
Class TargetClassInfoReader

java.lang.Object
  extended by jodd.asm.EmptyClassVisitor
      extended by jodd.proxetta.asm.TargetClassInfoReader
All Implemented Interfaces:
AsmConsts, ClassInfo, org.objectweb.asm.ClassVisitor

public class TargetClassInfoReader
extends EmptyClassVisitor
implements ClassInfo

Reads info from target class.


Field Summary
protected  java.util.Set<java.lang.String> allMethodSignatures
           
protected  AnnotationInfo[] annotations
           
protected  java.util.List<AnnotationInfo> classAnnotations
           
protected  int hierarchyLevel
           
protected  java.util.Map<java.lang.String,MethodSignatureVisitor> methodSignatures
           
protected  java.lang.String nextSupername
           
protected  java.lang.String[] superClasses
           
protected  java.util.List<org.objectweb.asm.ClassReader> superClassReaders
           
protected  java.lang.String superName
           
protected  java.lang.String targetClassname
           
protected  java.lang.String targetPackage
           
protected  java.lang.String thisReference
           
 
Fields inherited from interface jodd.proxetta.AsmConsts
ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, TYPE_ANNOTATION, TYPE_ARRAY, TYPE_BOOLEAN, TYPE_BYTE, TYPE_CHAR, TYPE_CLASS, TYPE_DOUBLE, TYPE_ENUM, TYPE_FLOAT, TYPE_INT, TYPE_LONG, TYPE_REFERENCE, TYPE_SHORT, TYPE_STRING, TYPE_VOID
 
Constructor Summary
TargetClassInfoReader()
           
 
Method Summary
protected  MethodSignatureVisitor createMethodSignature(int access, java.lang.String methodName, java.lang.String description, java.lang.String classname)
          Creates method signature from method name.
 AnnotationInfo[] getAnnotations()
          Returns annotation information or null if target class has no annotations.
 java.lang.String getClassname()
          Returns simple class name.
 java.lang.String getPackage()
          Returns package name.
 java.lang.String getReference()
          Returns class reference.
 java.lang.String[] getSuperClasses()
           
 java.lang.String getSuperName()
          Returns super class reference.
 boolean isMarkedForProxy(MethodSignatureVisitor msgin)
          Returns true if method is marked for proxy.
 MethodSignatureVisitor lookupMethodSignatureVisitor(int access, java.lang.String name, java.lang.String desc, java.lang.String className)
          Returns method signature for some method.
 void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
          Visits the header of the class.
 org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
          Visits an annotation of the class.
 void visitEnd()
          Stores signatures for all super public methods not already overriden by target class.
 org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
          Stores method signature for target method.
 
Methods inherited from class jodd.asm.EmptyClassVisitor
visitAttribute, visitField, visitInnerClass, visitOuterClass, visitSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methodSignatures

protected final java.util.Map<java.lang.String,MethodSignatureVisitor> methodSignatures

superClassReaders

protected final java.util.List<org.objectweb.asm.ClassReader> superClassReaders

allMethodSignatures

protected final java.util.Set<java.lang.String> allMethodSignatures

targetPackage

protected java.lang.String targetPackage

targetClassname

protected java.lang.String targetClassname

superName

protected java.lang.String superName

thisReference

protected java.lang.String thisReference

nextSupername

protected java.lang.String nextSupername

superClasses

protected java.lang.String[] superClasses

hierarchyLevel

protected int hierarchyLevel

annotations

protected AnnotationInfo[] annotations

classAnnotations

protected java.util.List<AnnotationInfo> classAnnotations
Constructor Detail

TargetClassInfoReader

public TargetClassInfoReader()
Method Detail

lookupMethodSignatureVisitor

public MethodSignatureVisitor lookupMethodSignatureVisitor(int access,
                                                           java.lang.String name,
                                                           java.lang.String desc,
                                                           java.lang.String className)
Returns method signature for some method. If signature is not found, returns null. Founded signatures means that those method can be proxyfied.


isMarkedForProxy

public boolean isMarkedForProxy(MethodSignatureVisitor msgin)
Returns true if method is marked for proxy.


getPackage

public java.lang.String getPackage()
Description copied from interface: ClassInfo
Returns package name.

Specified by:
getPackage in interface ClassInfo

getClassname

public java.lang.String getClassname()
Description copied from interface: ClassInfo
Returns simple class name.

Specified by:
getClassname in interface ClassInfo

getSuperName

public java.lang.String getSuperName()
Description copied from interface: ClassInfo
Returns super class reference.

Specified by:
getSuperName in interface ClassInfo

getReference

public java.lang.String getReference()
Description copied from interface: ClassInfo
Returns class reference.

Specified by:
getReference in interface ClassInfo

getSuperClasses

public java.lang.String[] getSuperClasses()

getAnnotations

public AnnotationInfo[] getAnnotations()
Description copied from interface: ClassInfo
Returns annotation information or null if target class has no annotations.

Specified by:
getAnnotations in interface ClassInfo

visit

public void visit(int version,
                  int access,
                  java.lang.String name,
                  java.lang.String signature,
                  java.lang.String superName,
                  java.lang.String[] interfaces)
Description copied from class: EmptyClassVisitor
Visits the header of the class.

Specified by:
visit in interface org.objectweb.asm.ClassVisitor
Overrides:
visit in class EmptyClassVisitor
Parameters:
version - the class version.
access - the class's access flags. This parameter also indicates if the class is deprecated.
name - the internal name of the class.
signature - the signature of this class. May be null if the class is not a generic one, and does not extend or implement generic classes or interfaces.
superName - the internal of name of the super class. For interfaces, the super class is Object. May be null, but only for the Object class.
interfaces - the internal names of the class's interfaces. May be null.

visitAnnotation

public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String desc,
                                                           boolean visible)
Description copied from class: EmptyClassVisitor
Visits an annotation of the class.

Specified by:
visitAnnotation in interface org.objectweb.asm.ClassVisitor
Overrides:
visitAnnotation in class EmptyClassVisitor
Parameters:
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
a visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation.

visitMethod

public org.objectweb.asm.MethodVisitor visitMethod(int access,
                                                   java.lang.String name,
                                                   java.lang.String desc,
                                                   java.lang.String signature,
                                                   java.lang.String[] exceptions)
Stores method signature for target method.

Specified by:
visitMethod in interface org.objectweb.asm.ClassVisitor
Overrides:
visitMethod in class EmptyClassVisitor
Parameters:
access - the method's access flags. This parameter also indicates if the method is synthetic and/or deprecated.
name - the method's name.
desc - the method's descriptor.
signature - the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.
exceptions - the internal names of the method's exception classes. May be null.
Returns:
an object to visit the byte code of the method, or null if this class visitor is not interested in visiting the code of this method.

visitEnd

public void visitEnd()
Stores signatures for all super public methods not already overriden by target class. All this methods will be accepted for proxyfication.

Specified by:
visitEnd in interface org.objectweb.asm.ClassVisitor
Overrides:
visitEnd in class EmptyClassVisitor

createMethodSignature

protected MethodSignatureVisitor createMethodSignature(int access,
                                                       java.lang.String methodName,
                                                       java.lang.String description,
                                                       java.lang.String classname)
Creates method signature from method name.



Copyright © 2003-2011 Jodd Team