[TEXT-183] add final to ConstantStringLookup.constantCache (#136)
* add final to ConstantStringLookup.constantCache
* change ConstantStringLookup.constantCache's name to CONSTANT_CACHE.
diff --git a/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java b/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java
index 05d211a..66f8298 100644
--- a/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java
@@ -64,7 +64,7 @@
class ConstantStringLookup extends AbstractStringLookup {
/** An internally used cache for already retrieved values. */
- private static ConcurrentHashMap<String, String> constantCache = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap<String, String> CONSTANT_CACHE = new ConcurrentHashMap<>();
/** Constant for the field separator. */
private static final char FIELD_SEPRATOR = '.';
@@ -78,7 +78,7 @@
* Clears the shared cache with the so far resolved constants.
*/
static void clear() {
- constantCache.clear();
+ CONSTANT_CACHE.clear();
}
/**
@@ -110,7 +110,7 @@
return null;
}
String result;
- result = constantCache.get(key);
+ result = CONSTANT_CACHE.get(key);
if (result != null) {
return result;
}
@@ -122,7 +122,7 @@
final Object value = resolveField(key.substring(0, fieldPos), key.substring(fieldPos + 1));
if (value != null) {
final String string = Objects.toString(value, null);
- constantCache.put(key, string);
+ CONSTANT_CACHE.put(key, string);
result = string;
}
} catch (final Exception ex) {