Package com.google.common.testing
Class FreshValueGenerator.FreshInvocationHandler
- java.lang.Object
-
- com.google.common.reflect.AbstractInvocationHandler
-
- com.google.common.testing.FreshValueGenerator.FreshInvocationHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
- Enclosing class:
- FreshValueGenerator
private final class FreshValueGenerator.FreshInvocationHandler extends AbstractInvocationHandler
-
-
Field Summary
Fields Modifier and Type Field Description private intidentityprivate java.lang.Class<?>interfaceType
-
Constructor Summary
Constructors Constructor Description FreshInvocationHandler(java.lang.Class<?> interfaceType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)By default delegates toObject.equals(java.lang.Object)so instances are only equal if they are identical.protected java.lang.ObjecthandleInvocation(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().inthashCode()By default delegates toObject.hashCode().java.lang.StringtoString()By default delegates toObject.toString().-
Methods inherited from class com.google.common.reflect.AbstractInvocationHandler
invoke
-
-
-
-
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:AbstractInvocationHandlerAbstractInvocationHandler.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[]),argswill never be null. When the method has no parameter, an empty array is passed in.- Specified by:
handleInvocationin classAbstractInvocationHandler
-
hashCode
public int hashCode()
Description copied from class:AbstractInvocationHandlerBy default delegates toObject.hashCode(). The dynamic proxies'hashCode()will delegate to this method. Subclasses can override this method to provide custom equality.- Overrides:
hashCodein classAbstractInvocationHandler
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:AbstractInvocationHandlerBy default delegates toObject.equals(java.lang.Object)so instances are only equal if they are identical.proxy.equals(argument)returns true if:proxyandargumentare of the same type- and this method returns true for the
InvocationHandlerofargument
Subclasses can override this method to provide custom equality.
- Overrides:
equalsin classAbstractInvocationHandler
-
toString
public java.lang.String toString()
Description copied from class:AbstractInvocationHandlerBy 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:
toStringin classAbstractInvocationHandler
-
-