Privatise fields
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1477612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5ce18d6487
commit
35e45cc127
|
@ -118,17 +118,17 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
|||
/**
|
||||
* The reference type for keys.
|
||||
*/
|
||||
protected ReferenceStrength keyType;
|
||||
private ReferenceStrength keyType;
|
||||
|
||||
/**
|
||||
* The reference type for values.
|
||||
*/
|
||||
protected ReferenceStrength valueType;
|
||||
private ReferenceStrength valueType;
|
||||
|
||||
/**
|
||||
* Should the value be automatically purged when the associated key has been collected?
|
||||
*/
|
||||
protected boolean purgeValues;
|
||||
private boolean purgeValues;
|
||||
|
||||
/**
|
||||
* ReferenceQueue used to eliminate stale mappings.
|
||||
|
@ -591,7 +591,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
|||
*/
|
||||
protected static class ReferenceEntry<K, V> extends HashEntry<K, V> {
|
||||
/** The parent map */
|
||||
protected final AbstractReferenceMap<K, V> parent;
|
||||
private final AbstractReferenceMap<K, V> parent;
|
||||
|
||||
/**
|
||||
* Creates a new entry object for the ReferenceMap.
|
||||
|
@ -1047,4 +1047,12 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
|||
// do not call super.doReadObject() as code there doesn't work for reference map
|
||||
}
|
||||
|
||||
/**
|
||||
* Provided protected read-only access to the key type.
|
||||
* @param type the type to check against.
|
||||
* @return true if keyType has the specified type
|
||||
*/
|
||||
protected boolean isKeyType(ReferenceStrength type) {
|
||||
return this.keyType == type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
|
|||
*/
|
||||
@Override
|
||||
protected boolean isEqualKey(final Object key1, Object key2) {
|
||||
key2 = keyType == ReferenceStrength.HARD ? key2 : ((Reference<?>) key2).get();
|
||||
key2 = isKeyType(ReferenceStrength.HARD) ? key2 : ((Reference<?>) key2).get();
|
||||
return key1 == key2;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue