private static final String AUGMENTATIONS = "augmentations";
private static final Object NULL_VALUE = new Object();
- private final ConcurrentHashMap<Method, Object> cachedData = new ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, Object> cachedData = new ConcurrentHashMap<>();
private final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> data;
private final DataObjectCodecContext<D,?> context;
}
private Object getBindingData(final Method method) {
- Object cached = cachedData.get(method);
+ // Guaranteed to be interned and since method has zero arguments, name is sufficient to identify the data,
+ // skipping Method.hashCode() computation.
+ final String methodName = method.getName();
+ Object cached = cachedData.get(methodName);
if (cached == null) {
final Object readedValue = context.getBindingChildValue(method, data);
if (readedValue == null) {
} else {
cached = readedValue;
}
- cachedData.putIfAbsent(method, cached);
+ cachedData.putIfAbsent(methodName, cached);
}
return cached == NULL_VALUE ? null : cached;