private final class FreshValueGenerator.FreshInvocationHandler extends AbstractInvocationHandler
Modifier and Type | Field and Description |
---|---|
private int |
identity |
private java.lang.Class<?> |
interfaceType |
Constructor and Description |
---|
FreshInvocationHandler(java.lang.Class<?> interfaceType) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
By default delegates to
Object.equals(java.lang.Object) so instances are only equal if they are
identical. |
protected java.lang.Object |
handleInvocation(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
AbstractInvocationHandler.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() . |
int |
hashCode()
By default delegates to
Object.hashCode() . |
java.lang.String |
toString()
By default delegates to
Object.toString() . |
invoke
private final int identity
private final java.lang.Class<?> interfaceType
protected java.lang.Object handleInvocation(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
AbstractInvocationHandler
AbstractInvocationHandler.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 AbstractInvocationHandler.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.
handleInvocation
in class AbstractInvocationHandler
public int hashCode()
AbstractInvocationHandler
Object.hashCode()
. The dynamic proxies' hashCode()
will
delegate to this method. Subclasses can override this method to provide custom equality.hashCode
in class AbstractInvocationHandler
public boolean equals(@Nullable java.lang.Object obj)
AbstractInvocationHandler
Object.equals(java.lang.Object)
so instances are only equal if they are
identical. proxy.equals(argument)
returns true if:
proxy
and argument
are of the same type
InvocationHandler
of argument
Subclasses can override this method to provide custom equality.
equals
in class AbstractInvocationHandler
public java.lang.String toString()
AbstractInvocationHandler
Object.toString()
. The dynamic proxies' toString()
will
delegate to this method. Subclasses can override this method to provide custom string
representation for the proxies.toString
in class AbstractInvocationHandler