Package com.google.common.testing
Class DummyProxy.DummyHandler
- java.lang.Object
-
- com.google.common.reflect.AbstractInvocationHandler
-
- com.google.common.testing.DummyProxy.DummyHandler
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.reflect.InvocationHandler
- Enclosing class:
- DummyProxy
private class DummyProxy.DummyHandler extends AbstractInvocationHandler implements java.io.Serializable
-
-
Field Summary
Fields Modifier and Type Field Description private TypeToken<?>
interfaceType
-
Constructor Summary
Constructors Constructor Description DummyHandler(TypeToken<?> interfaceType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
By default delegates toObject.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, exceptObject.equals(java.lang.Object)
,Object.hashCode()
andObject.toString()
.int
hashCode()
By default delegates toObject.hashCode()
.private DummyProxy
identity()
java.lang.String
toString()
By default delegates toObject.toString()
.private java.lang.Object
writeReplace()
-
Methods inherited from class com.google.common.reflect.AbstractInvocationHandler
invoke
-
-
-
-
Field Detail
-
interfaceType
private final TypeToken<?> interfaceType
-
-
Constructor Detail
-
DummyHandler
DummyHandler(TypeToken<?> interfaceType)
-
-
Method Detail
-
handleInvocation
protected java.lang.Object handleInvocation(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
Description copied from class: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, exceptObject.equals(java.lang.Object)
,Object.hashCode()
andObject.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.- Specified by:
handleInvocation
in classAbstractInvocationHandler
-
hashCode
public int hashCode()
Description copied from class:AbstractInvocationHandler
By default delegates toObject.hashCode()
. The dynamic proxies'hashCode()
will delegate to this method. Subclasses can override this method to provide custom equality.- Overrides:
hashCode
in classAbstractInvocationHandler
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:AbstractInvocationHandler
By default delegates toObject.equals(java.lang.Object)
so instances are only equal if they are identical.proxy.equals(argument)
returns true if:proxy
andargument
are of the same type- and this method returns true for the
InvocationHandler
ofargument
Subclasses can override this method to provide custom equality.
- Overrides:
equals
in classAbstractInvocationHandler
-
identity
private DummyProxy identity()
-
toString
public java.lang.String toString()
Description copied from class:AbstractInvocationHandler
By default delegates toObject.toString()
. The dynamic proxies'toString()
will delegate to this method. Subclasses can override this method to provide custom string representation for the proxies.- Overrides:
toString
in classAbstractInvocationHandler
-
writeReplace
private java.lang.Object writeReplace()
-
-