Class RuleSetCache
java.lang.Object
org.apache.commons.digester.annotations.internal.RuleSetCache
- All Implemented Interfaces:
Serializable
Simple in-memory LRU cache implementation.
- Since:
- 2.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The fixed cache size.private final int
The fixed cache capacity.private final Map<Class<?>,
FromAnnotationsRuleSet> The map that implements the LRU cache.private final float
The fixed cache load facor.private static final long
This class serialVersionUID. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
Verify that a key is not null.boolean
containsKey
(Class<?> key) Returns true if this cache contains a mapping for the specified key.Returns the value to which the specified key is cached, or null if this cache contains no mapping for the key.void
put
(Class<?> key, FromAnnotationsRuleSet value) Associates the specified value with the specified key in this cache.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDThis class serialVersionUID.- See Also:
-
cacheSize
private final int cacheSizeThe fixed cache size.- See Also:
-
loadFactor
private final float loadFactorThe fixed cache load facor.- See Also:
-
capacity
private final int capacityThe fixed cache capacity. -
data
The map that implements the LRU cache.
-
-
Constructor Details
-
RuleSetCache
public RuleSetCache()
-
-
Method Details
-
containsKey
Returns true if this cache contains a mapping for the specified key.- Parameters:
key
- key whose presence in this map is to be tested.- Returns:
- true if this map contains a mapping for the specified key, false otherwise.
-
get
Returns the value to which the specified key is cached, or null if this cache contains no mapping for the key. Key parameter must not be null.- Parameters:
key
- the key has to be checked it is present, it must not be null.- Returns:
- the value to which the specified key is cached, null if this cache contains no mapping for the key.
-
put
Associates the specified value with the specified key in this cache. Key parameter must not be null.- Parameters:
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
-
checkKey
Verify that a key is not null.- Type Parameters:
T
- the generic key type.- Parameters:
key
- the key object.
-