private static class ProxyFactory.CacheKey
extends java.lang.Object
If all the above criteria match between two keys, the keys are equivalent; else they are not.
Instances of this class are used in a cache, to ensure redundant proxy classes are not assembled and loaded. TODO: Since these cache keys rely in part on the proxies' parent classes and interfaces, their presence in the cache will prevent these parent classes and interfaces from being unloaded and garbage collected. This constitutes a potential memory leak, which should be resolved.
Modifier and Type | Field and Description |
---|---|
private boolean |
declaredOnly
Flag indicating only declared methods of interfaces are proxied
|
private java.lang.reflect.Method[] |
doNotProxy
Methods which are not to be proxied
|
private java.lang.Class<?>[] |
interfaces
Interfaces implemented by proxy class
|
private java.lang.Class<?> |
parent
Parent class of proxy class
|
Constructor and Description |
---|
CacheKey(java.lang.Class<?> parent,
java.lang.Class<?>[] interfaces,
boolean declaredOnly,
java.lang.reflect.Method[] doNotProxy)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Determine whether this object is equivalent to the given object.
|
int |
hashCode()
Return a well-distributed hash code which is consistent with this
class' implementation of
equals(Object) . |
private final java.lang.Class<?> parent
private final java.lang.Class<?>[] interfaces
private final boolean declaredOnly
private final java.lang.reflect.Method[] doNotProxy
CacheKey(java.lang.Class<?> parent, java.lang.Class<?>[] interfaces, boolean declaredOnly, java.lang.reflect.Method[] doNotProxy)
parent
- Parent class of proxy class.interfaces
- Interfaces implemented by proxy class.declaredOnly
- Flag indicating only declared methods of interfaces are
proxied.doNotProxy
- Methods which are not to be proxied. May be an empty array,
but must not be null
.public int hashCode()
equals(Object)
.hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
Two cache keys are considered equivalent if their various fields are equivalent.
equals
in class java.lang.Object
o
- Another object to test for equivalence with this one.true
if o
is another instance of
this class with equivalent fields, else false
.