com.google.common.reflect
@Beta public abstract class AbstractInvocationHandler extends Object implements InvocationHandler
InvocationHandler
that handles Object.equals(java.lang.Object)
,
Object.hashCode()
and Object.toString()
.Constructor and Description |
---|
AbstractInvocationHandler() |
Modifier and Type | Method and Description |
---|---|
protected abstract Object |
handleInvocation(Object proxy,
Method method,
Object[] args)
invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) delegates to this method upon any method invocation on the proxy instance,
except Object.equals(java.lang.Object) , Object.hashCode() and Object.toString() . |
Object |
invoke(Object proxy,
Method method,
Object[] args) |
String |
toString()
The dynamic proxies'
Object.toString() will delegate to this method. |
public AbstractInvocationHandler()
public final Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable
Object.equals(java.lang.Object)
, Object.hashCode()
are implemented according to referential
equality (the default behavior of Object
). Object.toString()
delegates to
toString()
that can be overridden by subclasses.
invoke
in interface InvocationHandler
Throwable
protected abstract Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable
invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
delegates to this method upon any method invocation on the proxy instance,
except Object.equals(java.lang.Object)
, Object.hashCode()
and Object.toString()
. The result
will be returned as the proxied method's return value.
Unlike invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
, args
will never be null. When the method has no parameter,
an empty array is passed in.
Throwable
public String toString()
Object.toString()
will delegate to this method. Subclasses can
override this to provide custom string representation of the proxies.Copyright © 2010-2018. All Rights Reserved.