Top Description Inners Fields Constructors Methods
org.springframework.cglib.proxy

public Class MethodProxy

extends Object
Class Inheritance
Annotations
@SuppressWarnings:rawtypes, unchecked
Imports
java.lang.reflect.InvocationTargetException, .Method, org.springframework.cglib.core.AbstractClassGenerator, .CodeGenerationException, .GeneratorStrategy, .NamingPolicy, .Signature, org.springframework.cglib.reflect.FastClass

Classes generated by Enhancer pass this object to the registered MethodInterceptor objects when an intercepted method is invoked. It can be used to either invoke the original method, or call the same method on a different object of the same type.
Version
$Id: MethodProxy.java,v 1.16 2009/01/11 20:09:48 herbyderby Exp $

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private MethodProxy.CreateInfo
private volatile MethodProxy.FastClassInfo
private final Object
private Signature
private Signature

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static MethodProxy
create(Class<T> c1, Class<T> c2, String desc, String name1, String name2)

For internal use by Enhancer only; see the org.springframework.cglib.reflect.FastMethod class for similar functionality.

public static MethodProxy

Returns:

the MethodProxy instance, or null if no applicable matching method is found
find
(Class<T>
the class generated by Enhancer
type
,
Signature
the signature to match
sig
)

Return the MethodProxy used when intercepting the method matching the given signature.

pack-priv FastClass
public Signature
getSignature()

Return the signature of the proxied method.

pack-priv FastClass
public int
getSuperIndex()

Return the org.springframework.cglib.reflect.FastClass method index for the method used by invokeSuper.

public String
getSuperName()

Return the name of the synthetic method created by CGLIB which is used by invokeSuper to invoke the superclass (non-intercepted) method implementation.

private static FastClass
private void
init()

public Object
invoke(Object
the compatible object; recursion will result if you use the object passed as the first argument to the MethodInterceptor (usually not what you want)
obj
,
Object[]
the arguments passed to the intercepted method; you may substitute a different argument array as long as the types are compatible
args
)

Invoke the original method, on a different object of the same type.

public Object
invokeSuper(Object
the enhanced object, must be the object passed as the first argument to the MethodInterceptor
obj
,
Object[]
the arguments passed to the intercepted method; you may substitute a different argument array as long as the types are compatible
args
)

Invoke the original (super) method on the specified object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

createInfoback to summary
private MethodProxy.CreateInfo createInfo
fastClassInfoback to summary
private volatile MethodProxy.FastClassInfo fastClassInfo
initLockback to summary
private final Object initLock
sig1back to summary
private Signature sig1
sig2back to summary
private Signature sig2

Constructor Detail

MethodProxyback to summary
private MethodProxy()

Method Detail

createback to summary
public static MethodProxy create(Class<T> c1, Class<T> c2, String desc, String name1, String name2)

For internal use by Enhancer only; see the org.springframework.cglib.reflect.FastMethod class for similar functionality.

findback to summary
public static MethodProxy find(Class<T> type, Signature sig)

Return the MethodProxy used when intercepting the method matching the given signature.

Parameters
type:Class<T>

the class generated by Enhancer

sig:Signature

the signature to match

Returns:MethodProxy

the MethodProxy instance, or null if no applicable matching method is found

Exceptions
IllegalArgumentException:
if the Class was not created by Enhancer or does not use a MethodInterceptor
getFastClassback to summary
pack-priv FastClass getFastClass()
getSignatureback to summary
public Signature getSignature()

Return the signature of the proxied method.

getSuperFastClassback to summary
pack-priv FastClass getSuperFastClass()
getSuperIndexback to summary
public int getSuperIndex()

Return the org.springframework.cglib.reflect.FastClass method index for the method used by invokeSuper. This index uniquely identifies the method within the generated proxy, and therefore can be useful to reference external metadata.

See Also
getSuperName
getSuperNameback to summary
public String getSuperName()

Return the name of the synthetic method created by CGLIB which is used by invokeSuper to invoke the superclass (non-intercepted) method implementation. The parameter types are the same as the proxied method.

helperback to summary
private static FastClass helper(MethodProxy.CreateInfo ci, Class<T> type)
initback to summary
private void init()
invokeback to summary
public Object invoke(Object obj, Object[] args) throws Throwable

Invoke the original method, on a different object of the same type.

Parameters
obj:Object

the compatible object; recursion will result if you use the object passed as the first argument to the MethodInterceptor (usually not what you want)

args:Object[]

the arguments passed to the intercepted method; you may substitute a different argument array as long as the types are compatible

Exceptions
Throwable:
the bare exceptions thrown by the called method are passed through without wrapping in an InvocationTargetException
See Also
MethodInterceptor#intercept
invokeSuperback to summary
public Object invokeSuper(Object obj, Object[] args) throws Throwable

Invoke the original (super) method on the specified object.

Parameters
obj:Object

the enhanced object, must be the object passed as the first argument to the MethodInterceptor

args:Object[]

the arguments passed to the intercepted method; you may substitute a different argument array as long as the types are compatible

Exceptions
Throwable:
the bare exceptions thrown by the called method are passed through without wrapping in an InvocationTargetException
See Also
MethodInterceptor#intercept
org.springframework.cglib.proxy back to summary

private Class MethodProxy.CreateInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv Class<T>
pack-priv Class<T>
pack-priv NamingPolicy
pack-priv GeneratorStrategy

Constructor Summary

AccessConstructor and Description
public
CreateInfo(Class<T> c1, Class<T> c2)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attemptLoadback to summary
pack-priv boolean attemptLoad
c1back to summary
pack-priv Class<T> c1
c2back to summary
pack-priv Class<T> c2
namingPolicyback to summary
pack-priv NamingPolicy namingPolicy
strategyback to summary
pack-priv GeneratorStrategy strategy

Constructor Detail

CreateInfoback to summary
public CreateInfo(Class<T> c1, Class<T> c2)
org.springframework.cglib.proxy back to summary

private Class MethodProxy.FastClassInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv FastClass
pack-priv FastClass
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

f1back to summary
pack-priv FastClass f1
f2back to summary
pack-priv FastClass f2
i1back to summary
pack-priv int i1
i2back to summary
pack-priv int i2

Constructor Detail

FastClassInfoback to summary
private FastClassInfo()