Package com.google.common.cache
Enum Class LocalCache.EntryFactory
- All Implemented Interfaces:
Serializable
,Comparable<LocalCache.EntryFactory>
,Constable
- Enclosing class:
LocalCache<K,
V>
Creates new entries.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
(package private) static final LocalCache.EntryFactory[]
Look-up table for factories.(package private) static final int
(package private) static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) <K,
V> void copyAccessEntry
(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newEntry) (package private) <K,
V> ReferenceEntry <K, V> copyEntry
(LocalCache.Segment<K, V> segment, ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext, K key) Copies an entry, assigning it a newnext
entry.(package private) <K,
V> void copyWriteEntry
(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newEntry) (package private) static LocalCache.EntryFactory
getFactory
(LocalCache.Strength keyStrength, boolean usesAccessQueue, boolean usesWriteQueue) (package private) abstract <K,
V> ReferenceEntry <K, V> newEntry
(LocalCache.Segment<K, V> segment, K key, int hash, ReferenceEntry<K, V> next) Creates a new entry.static LocalCache.EntryFactory
Returns the enum constant of this class with the specified name.static LocalCache.EntryFactory[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STRONG
-
STRONG_ACCESS
-
STRONG_WRITE
-
STRONG_ACCESS_WRITE
-
WEAK
-
WEAK_ACCESS
-
WEAK_WRITE
-
WEAK_ACCESS_WRITE
-
-
Field Details
-
ACCESS_MASK
static final int ACCESS_MASK- See Also:
-
WRITE_MASK
static final int WRITE_MASK- See Also:
-
WEAK_MASK
static final int WEAK_MASK- See Also:
-
factories
Look-up table for factories.
-
-
Constructor Details
-
EntryFactory
private EntryFactory()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getFactory
static LocalCache.EntryFactory getFactory(LocalCache.Strength keyStrength, boolean usesAccessQueue, boolean usesWriteQueue) -
newEntry
abstract <K,V> ReferenceEntry<K,V> newEntry(LocalCache.Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) Creates a new entry.- Parameters:
segment
- to create the entry forkey
- of the entryhash
- of the keynext
- entry in the same bucket
-
copyEntry
<K,V> ReferenceEntry<K,V> copyEntry(LocalCache.Segment<K, V> segment, ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext, K key) Copies an entry, assigning it a newnext
entry.- Parameters:
original
- the entry to copy. But avoid callinggetKey
on it: Instead, use thekey
parameter. That way, we prevent the key from being garbage collected in the case of weak keys. If we create a new entry with a key that is null at construction time, we're not sure if entry will necessarily ever be garbage collected.newNext
- entry in the same bucketkey
- the key to copy from the original entry to the new one. Use this in preference tooriginal.getKey()
.
-
copyAccessEntry
-
copyWriteEntry
-