public abstract class ConversionHandler extends Object implements InvocationHandler, Serializable
Constructor and Description |
---|
ConversionHandler(Object delegate)
Creates a ConversionHandler with an delegate.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkMethod(Method method) |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
Object |
getDelegate()
Returns the delegate.
|
int |
hashCode()
Returns a hash code value for the delegate.
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
This method is a default implementation for the invoke method given in
InvocationHandler.
|
abstract Object |
invokeCustom(Object proxy,
Method method,
Object[] args)
This method is called for all Methods not defined on Object.
|
static boolean |
isCoreObjectMethod(Method method)
Checks whether a method is a core method from java.lang.Object.
|
String |
toString()
Returns a String version of the delegate.
|
public ConversionHandler(Object delegate)
delegate
- the delegateIllegalArgumentException
- if the given delegate is nullpublic Object getDelegate()
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
In many scenarios, it is better to overwrite the invokeCustom method where the core Object related methods are filtered out.
invoke
in interface InvocationHandler
proxy
- the proxymethod
- the methodargs
- the argumentsThrowable
- if caused by the delegate or the methodinvokeCustom(Object, Method, Object[])
,
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
protected boolean checkMethod(Method method)
public abstract Object invokeCustom(Object proxy, Method method, Object[] args) throws Throwable
proxy
- the proxymethod
- the methodargs
- the argumentsThrowable
- any exception causes by the delegateinvoke(Object, Method, Object[])
,
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
public static boolean isCoreObjectMethod(Method method)
method
- the method to check