net.sf.retrotranslator.runtime.impl
Class MethodDescriptor

java.lang.Object
  extended by net.sf.retrotranslator.runtime.impl.EmptyVisitor
      extended by net.sf.retrotranslator.runtime.impl.AnnotatedElementDescriptor
          extended by net.sf.retrotranslator.runtime.impl.GenericDeclarationDescriptor
              extended by net.sf.retrotranslator.runtime.impl.MethodDescriptor
All Implemented Interfaces:
AnnotationVisitor, ClassVisitor, FieldVisitor, MethodVisitor, SignatureVisitor, MemberDescriptor

public class MethodDescriptor
extends GenericDeclarationDescriptor
implements MemberDescriptor

Author:
Taras Puchko

Field Summary
private  ClassDescriptor classDescriptor
           
private  LazyValue<java.lang.Class,java.lang.reflect.Constructor> constructor
           
private  LazyValue<java.lang.Object,java.lang.Object> defaultValue
           
private  java.lang.String desc
           
private  LazyList<TypeDescriptor,java.lang.reflect.Type> genericExceptionTypes
           
private  LazyList<TypeDescriptor,java.lang.reflect.Type> genericParameterTypes
           
private  LazyValue<TypeDescriptor,java.lang.reflect.Type> genericReturnType
           
private  LazyValue<java.lang.Class,java.lang.reflect.Method> method
           
private  java.lang.String name
           
private  LazyList<java.util.List<AnnotationValue>,Annotation_[]> parameterAnnotations
           
private  LazyValue<java.lang.String,java.lang.Class> returnType
           
 
Fields inherited from class net.sf.retrotranslator.runtime.impl.AnnotatedElementDescriptor
access, EMPTY_VISITOR
 
Fields inherited from interface net.sf.retrotranslator.runtime.asm.signature.SignatureVisitor
EXTENDS, INSTANCEOF, SUPER
 
Constructor Summary
MethodDescriptor(ClassDescriptor classDescriptor, int access, java.lang.String name, java.lang.String desc, java.lang.String signature)
           
 
Method Summary
protected  Annotation_[] createAnnotations(Annotation_[] declaredAnnotations)
           
private  LazyValue<java.lang.Class,java.lang.reflect.Constructor> createConstructor()
           
private  LazyValue<java.lang.Class,java.lang.reflect.Method> createMethod()
           
private  LazyList<java.util.List<AnnotationValue>,Annotation_[]> createParameterAnnotations()
           
private  LazyValue<java.lang.String,java.lang.Class> createReturnType()
           
protected  java.lang.reflect.TypeVariable findTypeVariable(java.lang.String name)
           
 ClassDescriptor getClassDescriptor()
           
 java.lang.reflect.Constructor getConstructor()
           
 java.lang.Object getDefaultValue()
           
 java.lang.String getDesc()
           
 java.lang.reflect.Type[] getGenericExceptionTypes()
           
 java.lang.reflect.Type[] getGenericParameterTypes()
           
 java.lang.reflect.Type getGenericReturnType()
           
static MethodDescriptor getInstance(java.lang.reflect.Constructor constructor)
           
static MethodDescriptor getInstance(java.lang.reflect.Method method)
           
 java.lang.reflect.Method getMethod()
           
 java.lang.String getName()
           
 Annotation_[][] getParameterAnnotations()
           
 java.lang.Class getReturnType()
           
 java.lang.reflect.GenericDeclaration getTarget()
           
private  void setDefaultValue(java.lang.Object o)
           
 void visit(java.lang.String name, java.lang.Object value)
          Visits a primitive value of the annotation.
 AnnotationVisitor visitAnnotation(java.lang.String name, java.lang.String desc)
          Visits a nested annotation value of the annotation.
 AnnotationVisitor visitArray(java.lang.String name)
          Visits an array value of the annotation.
 void visitEnum(java.lang.String name, java.lang.String desc, java.lang.String value)
          Visits an enumeration value of the annotation.
 SignatureVisitor visitExceptionType()
          Visits the type of a method exception.
 AnnotationVisitor visitParameterAnnotation(int parameter, java.lang.String desc, boolean visible)
          Visits an annotation of a parameter this method.
 SignatureVisitor visitParameterType()
          Visits the type of a method parameter.
 SignatureVisitor visitReturnType()
          Visits the return type of the method.
 
Methods inherited from class net.sf.retrotranslator.runtime.impl.GenericDeclarationDescriptor
getTypeParameters, getTypeVariable, visitClassBound, visitFormalTypeParameter, visitInterfaceBound
 
Methods inherited from class net.sf.retrotranslator.runtime.impl.AnnotatedElementDescriptor
createAnnotations, createType, createTypes, getAnnotation, getAnnotations, getClassByInternalName, getClassByType, getDeclaredAnnotations, getLazyList, getLazyType, isAccess, isAnnotationPresent, resolveValue, visitAnnotation
 
Methods inherited from class net.sf.retrotranslator.runtime.impl.EmptyVisitor
visit, visitAnnotationDefault, visitArrayType, visitAttribute, visitBaseType, visitClassType, visitCode, visitEnd, visitField, visitFieldInsn, visitIincInsn, visitInnerClass, visitInnerClassType, visitInsn, visitInterface, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethod, visitMethodInsn, visitMultiANewArrayInsn, visitOuterClass, visitSource, visitSuperclass, visitTableSwitchInsn, visitTryCatchBlock, visitTypeArgument, visitTypeArgument, visitTypeInsn, visitTypeVariable, visitVarInsn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name

desc

private java.lang.String desc

classDescriptor

private ClassDescriptor classDescriptor

method

private LazyValue<java.lang.Class,java.lang.reflect.Method> method

returnType

private LazyValue<java.lang.String,java.lang.Class> returnType

defaultValue

private LazyValue<java.lang.Object,java.lang.Object> defaultValue

constructor

private LazyValue<java.lang.Class,java.lang.reflect.Constructor> constructor

genericReturnType

private LazyValue<TypeDescriptor,java.lang.reflect.Type> genericReturnType

genericParameterTypes

private LazyList<TypeDescriptor,java.lang.reflect.Type> genericParameterTypes

genericExceptionTypes

private LazyList<TypeDescriptor,java.lang.reflect.Type> genericExceptionTypes

parameterAnnotations

private LazyList<java.util.List<AnnotationValue>,Annotation_[]> parameterAnnotations
Constructor Detail

MethodDescriptor

public MethodDescriptor(ClassDescriptor classDescriptor,
                        int access,
                        java.lang.String name,
                        java.lang.String desc,
                        java.lang.String signature)
Method Detail

createReturnType

private LazyValue<java.lang.String,java.lang.Class> createReturnType()

createConstructor

private LazyValue<java.lang.Class,java.lang.reflect.Constructor> createConstructor()

createMethod

private LazyValue<java.lang.Class,java.lang.reflect.Method> createMethod()

getName

public java.lang.String getName()
Specified by:
getName in interface MemberDescriptor

getDesc

public java.lang.String getDesc()
Specified by:
getDesc in interface MemberDescriptor

getReturnType

public java.lang.Class getReturnType()

getDefaultValue

public java.lang.Object getDefaultValue()

getInstance

public static MethodDescriptor getInstance(java.lang.reflect.Method method)

getInstance

public static MethodDescriptor getInstance(java.lang.reflect.Constructor constructor)

getTarget

public java.lang.reflect.GenericDeclaration getTarget()
Specified by:
getTarget in class GenericDeclarationDescriptor

getMethod

public java.lang.reflect.Method getMethod()

getConstructor

public java.lang.reflect.Constructor getConstructor()

getClassDescriptor

public ClassDescriptor getClassDescriptor()
Specified by:
getClassDescriptor in class AnnotatedElementDescriptor

findTypeVariable

protected java.lang.reflect.TypeVariable findTypeVariable(java.lang.String name)
Specified by:
findTypeVariable in class AnnotatedElementDescriptor

getParameterAnnotations

public Annotation_[][] getParameterAnnotations()

createParameterAnnotations

private LazyList<java.util.List<AnnotationValue>,Annotation_[]> createParameterAnnotations()

getGenericReturnType

public java.lang.reflect.Type getGenericReturnType()

getGenericParameterTypes

public java.lang.reflect.Type[] getGenericParameterTypes()

getGenericExceptionTypes

public java.lang.reflect.Type[] getGenericExceptionTypes()

createAnnotations

protected Annotation_[] createAnnotations(Annotation_[] declaredAnnotations)
Specified by:
createAnnotations in class AnnotatedElementDescriptor

visitParameterAnnotation

public AnnotationVisitor visitParameterAnnotation(int parameter,
                                                  java.lang.String desc,
                                                  boolean visible)
Description copied from interface: MethodVisitor
Visits an annotation of a parameter this method.

Specified by:
visitParameterAnnotation in interface MethodVisitor
Overrides:
visitParameterAnnotation in class EmptyVisitor
Parameters:
parameter - the parameter index.
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
a non null visitor to visit the annotation values.

visit

public void visit(java.lang.String name,
                  java.lang.Object value)
Description copied from interface: AnnotationVisitor
Visits a primitive value of the annotation.

Specified by:
visit in interface AnnotationVisitor
Overrides:
visit in class EmptyVisitor
Parameters:
name - the value name.
value - the actual value, whose type must be Byte, Boolean, Character, Short, Integer, Long, Float, Double, String or Type.

visitEnum

public void visitEnum(java.lang.String name,
                      java.lang.String desc,
                      java.lang.String value)
Description copied from interface: AnnotationVisitor
Visits an enumeration value of the annotation.

Specified by:
visitEnum in interface AnnotationVisitor
Overrides:
visitEnum in class EmptyVisitor
Parameters:
name - the value name.
desc - the class descriptor of the enumeration class.
value - the actual enumeration value.

visitAnnotation

public AnnotationVisitor visitAnnotation(java.lang.String name,
                                         java.lang.String desc)
Description copied from interface: AnnotationVisitor
Visits a nested annotation value of the annotation.

Specified by:
visitAnnotation in interface AnnotationVisitor
Overrides:
visitAnnotation in class EmptyVisitor
Parameters:
name - the value name.
desc - the class descriptor of the nested annotation class.
Returns:
a non null visitor to visit the actual nested annotation value. The nested annotation value must be fully visited before calling other methods on this annotation visitor.

visitArray

public AnnotationVisitor visitArray(java.lang.String name)
Description copied from interface: AnnotationVisitor
Visits an array value of the annotation.

Specified by:
visitArray in interface AnnotationVisitor
Overrides:
visitArray in class EmptyVisitor
Parameters:
name - the value name.
Returns:
a non null visitor to visit the actual array value elements. The 'name' parameters passed to the methods of this visitor are ignored. All the array values must be visited before calling other methods on this annotation visitor.

visitParameterType

public SignatureVisitor visitParameterType()
Description copied from interface: SignatureVisitor
Visits the type of a method parameter.

Specified by:
visitParameterType in interface SignatureVisitor
Overrides:
visitParameterType in class EmptyVisitor
Returns:
a non null visitor to visit the signature of the parameter type.

visitReturnType

public SignatureVisitor visitReturnType()
Description copied from interface: SignatureVisitor
Visits the return type of the method.

Specified by:
visitReturnType in interface SignatureVisitor
Overrides:
visitReturnType in class EmptyVisitor
Returns:
a non null visitor to visit the signature of the return type.

visitExceptionType

public SignatureVisitor visitExceptionType()
Description copied from interface: SignatureVisitor
Visits the type of a method exception.

Specified by:
visitExceptionType in interface SignatureVisitor
Overrides:
visitExceptionType in class EmptyVisitor
Returns:
a non null visitor to visit the signature of the exception type.

setDefaultValue

private void setDefaultValue(java.lang.Object o)