JBoss Reflection 2.2.1.SP1

org.jboss.reflect.plugins.javassist
Class JavassistMethodInfo

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.reflect.plugins.AbstractAnnotatedInfo
          extended by org.jboss.reflect.plugins.javassist.JavassistAnnotatedInfo
              extended by org.jboss.reflect.plugins.javassist.JavassistAnnotatedParameterInfo
                  extended by org.jboss.reflect.plugins.javassist.JavassistMethodInfo
All Implemented Interfaces:
Serializable, Cloneable, MethodInfoInternal, AnnotatedInfo, MemberInfo, MethodInfo, ModifierInfo, MutableMethodInfo, org.jboss.util.JBossInterface

public class JavassistMethodInfo
extends JavassistAnnotatedParameterInfo
implements MutableMethodInfo, MethodInfoInternal

MethodInfo that relies on Javassist to answer reflective queries and to invoke the represented method. This class also relies on Javassist to perform the instrumentation operations defined in MutableMethodInfo.

Version:
$Revision: 105870 $
Author:
Adrian Brock, Kabir Khan
See Also:
MutableMethodInfo, Serialized Form

Field Summary
 
Fields inherited from class org.jboss.reflect.plugins.javassist.JavassistAnnotatedParameterInfo
ctBehavior, exceptionTypes, parameters, parameterTypes, typeInfo
 
Fields inherited from class org.jboss.reflect.plugins.javassist.JavassistAnnotatedInfo
annotationHelper, annotationMap, annotationsArray
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Fields inherited from interface org.jboss.reflect.spi.MethodInfo
NO_EXCEPTIONS, NO_PARAMS, NO_PARAMS_TYPES
 
Fields inherited from interface org.jboss.reflect.spi.ModifierInfo
ABSTRACT, CONSTANT, FINAL, PACKAGE, PACKAGE_ABSTRACT, PACKAGE_CONSTANT, PACKAGE_STATIC, PRIVATE, PRIVATE_CONSTANT, PRIVATE_STATIC, PROTECTED, PROTECTED_ABSTRACT, PROTECTED_CONSTANT, PROTECTED_STATIC, PUBLIC, PUBLIC_ABSTRACT, PUBLIC_CONSTANT, PUBLIC_STATIC, STATIC
 
Constructor Summary
JavassistMethodInfo(SignatureKey signatureKey, AnnotationHelper annotationHelper, JavassistTypeInfo typeInfo, javassist.CtMethod ctMethod)
          Create a new JavassistMethodInfo.
 
Method Summary
 boolean equals(Object obj)
           
 void executeCommand(MutableMethodInfoCommand mmc)
          TODO: something similar to CtBehavior.instrument(...)
 javassist.CtMethod getCtMethod()
           
protected  int getHashCode()
           
 String getName()
          Get the method name
 int getNumberParameters()
           
 TypeInfo getReturnType()
          Get the return type
 Object invoke(Object target, Object[] args)
          Invoke the method
 void setName(String name)
          Method name
 void setReturnType(ClassInfo returnType)
          Set type of the returned value
 void setReturnType(String returnType)
          Set type of the returned value
 void toShortString(org.jboss.util.JBossStringBuilder buffer)
           
protected  void toString(org.jboss.util.JBossStringBuilder buffer)
           
 
Methods inherited from class org.jboss.reflect.plugins.javassist.JavassistAnnotatedParameterInfo
createParameterAnnotations, generateParameters, getAnnotations, getDeclaringClass, getDescriptor, getExceptionTypes, getMethodSignature, getModifiers, getParameters, getParameterTypes, getSignatureKey, isPublic, isStatic, isVolatile, setBody, setExceptions, setExceptions, setModifier, setParameters, setParameters, setupParameterAnnotations
 
Methods inherited from class org.jboss.reflect.plugins.javassist.JavassistAnnotatedInfo
getAnnotation, getAnnotations, isAnnotationPresent, setupAnnotations
 
Methods inherited from class org.jboss.reflect.plugins.AbstractAnnotatedInfo
getUnderlyingAnnotation, getUnderlyingAnnotations, isAnnotationPresent
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, hashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.reflect.spi.MutableMethodInfo
setBody, setExceptions, setExceptions, setModifier, setParameters, setParameters
 
Methods inherited from interface org.jboss.reflect.spi.MethodInfo
getExceptionTypes, getParameters, getParameterTypes
 
Methods inherited from interface org.jboss.reflect.spi.AnnotatedInfo
getAnnotation, getAnnotations, getUnderlyingAnnotation, getUnderlyingAnnotations, isAnnotationPresent, isAnnotationPresent
 
Methods inherited from interface org.jboss.util.JBossInterface
clone, toShortString
 
Methods inherited from interface org.jboss.reflect.spi.MemberInfo
getDeclaringClass
 
Methods inherited from interface org.jboss.reflect.spi.ModifierInfo
getModifiers, isPublic, isStatic, isVolatile
 

Constructor Detail

JavassistMethodInfo

public JavassistMethodInfo(SignatureKey signatureKey,
                           AnnotationHelper annotationHelper,
                           JavassistTypeInfo typeInfo,
                           javassist.CtMethod ctMethod)
Create a new JavassistMethodInfo.

Parameters:
annotationHelper - the annotation helper
typeInfo - the type info
ctMethod - the method
Method Detail

getName

public String getName()
Description copied from interface: MethodInfo
Get the method name

Specified by:
getName in interface MethodInfo
Specified by:
getName in class JavassistAnnotatedParameterInfo
Returns:
the method name

getReturnType

public TypeInfo getReturnType()
Description copied from interface: MethodInfo
Get the return type

Specified by:
getReturnType in interface MethodInfo
Returns:
the return type

invoke

public Object invoke(Object target,
                     Object[] args)
              throws Throwable
Description copied from interface: MethodInfo
Invoke the method

Specified by:
invoke in interface MethodInfo
Parameters:
target - the target
args - the arguments
Returns:
the result of the invocation
Throws:
Throwable - for any error

getHashCode

protected int getHashCode()
Overrides:
getHashCode in class org.jboss.util.JBossObject

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toShortString

public void toShortString(org.jboss.util.JBossStringBuilder buffer)
Specified by:
toShortString in interface org.jboss.util.JBossInterface
Overrides:
toShortString in class org.jboss.util.JBossObject

toString

protected void toString(org.jboss.util.JBossStringBuilder buffer)
Overrides:
toString in class org.jboss.util.JBossObject

executeCommand

public void executeCommand(MutableMethodInfoCommand mmc)
Description copied from interface: MutableMethodInfo
TODO: something similar to CtBehavior.instrument(...)

Specified by:
executeCommand in interface MutableMethodInfo

getCtMethod

public javassist.CtMethod getCtMethod()

setName

public void setName(String name)
Description copied from interface: MutableMethodInfo
Method name

Specified by:
setName in interface MutableMethodInfo

setReturnType

public void setReturnType(String returnType)
Description copied from interface: MutableMethodInfo
Set type of the returned value

Specified by:
setReturnType in interface MutableMethodInfo

setReturnType

public void setReturnType(ClassInfo returnType)
Description copied from interface: MutableMethodInfo
Set type of the returned value

Specified by:
setReturnType in interface MutableMethodInfo

getNumberParameters

public int getNumberParameters()
Specified by:
getNumberParameters in interface MethodInfoInternal

JBoss Reflection 2.2.1.SP1

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.