DATACMNS-1755 - Rename uppercase 'CACHE' static finals.
Rename static final `CACHE` members to use the lowercase form. Although the caches are static final, they are not constant values. Original pull request: #448.
This commit is contained in:
committed by
Mark Paluch
parent
df5f42ce29
commit
cb8443e299
@@ -52,7 +52,7 @@ final class AnnotationAuditingMetadata {
|
||||
private static final AnnotationFieldFilter LAST_MODIFIED_DATE_FILTER = new AnnotationFieldFilter(
|
||||
LastModifiedDate.class);
|
||||
|
||||
private static final Map<Class<?>, AnnotationAuditingMetadata> METADATA_CACHE = new ConcurrentHashMap<>();
|
||||
private static final Map<Class<?>, AnnotationAuditingMetadata> metadataCache = new ConcurrentHashMap<>();
|
||||
|
||||
public static final boolean IS_JDK_8 = org.springframework.util.ClassUtils.isPresent("java.time.Clock",
|
||||
AnnotationAuditingMetadata.class.getClassLoader());
|
||||
@@ -125,7 +125,7 @@ final class AnnotationAuditingMetadata {
|
||||
* @param type the type to inspect, must not be {@literal null}.
|
||||
*/
|
||||
public static AnnotationAuditingMetadata getMetadata(Class<?> type) {
|
||||
return METADATA_CACHE.computeIfAbsent(type, AnnotationAuditingMetadata::new);
|
||||
return metadataCache.computeIfAbsent(type, AnnotationAuditingMetadata::new);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class SimpleTypeInformationMapper implements TypeInformationMapper {
|
||||
|
||||
private final Map<String, Optional<ClassTypeInformation<?>>> CACHE = new ConcurrentHashMap<>();
|
||||
private final Map<String, Optional<ClassTypeInformation<?>>> cache = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Returns the {@link TypeInformation} that shall be used when the given {@link String} value is found as type hint.
|
||||
@@ -53,7 +53,7 @@ public class SimpleTypeInformationMapper implements TypeInformationMapper {
|
||||
String stringAlias = alias.mapTyped(String.class);
|
||||
|
||||
if (stringAlias != null) {
|
||||
return CACHE.computeIfAbsent(stringAlias, SimpleTypeInformationMapper::loadClass).orElse(null);
|
||||
return cache.computeIfAbsent(stringAlias, SimpleTypeInformationMapper::loadClass).orElse(null);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
private static final String ALL_UPPERCASE = "[A-Z0-9._$]+";
|
||||
private static final Pattern SPLITTER = Pattern.compile("(?:[%s]?([%s]*?[^%s]+))".replaceAll("%s", DELIMITERS));
|
||||
private static final Pattern SPLITTER_FOR_QUOTED = Pattern.compile("(?:[%s]?([%s]*?[^%s]+))".replaceAll("%s", "\\."));
|
||||
private static final Map<Key, PropertyPath> CACHE = new ConcurrentReferenceHashMap<>();
|
||||
private static final Map<Key, PropertyPath> cache = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
private final TypeInformation<?> owningType;
|
||||
private final String name;
|
||||
@@ -345,7 +345,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
Assert.hasText(source, "Source must not be null or empty!");
|
||||
Assert.notNull(type, "TypeInformation must not be null or empty!");
|
||||
|
||||
return CACHE.computeIfAbsent(Key.of(type, source), it -> {
|
||||
return cache.computeIfAbsent(Key.of(type, source), it -> {
|
||||
|
||||
List<String> iteratorSource = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
*/
|
||||
static class KotlinCopyUtil {
|
||||
|
||||
private static final Map<Class<?>, KCallable<?>> COPY_METHOD_CACHE = new ConcurrentReferenceHashMap<>();
|
||||
private static final Map<Class<?>, KCallable<?>> copyMethodCache = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
/**
|
||||
* Set a single property by calling {@code copy(…)} on a Kotlin data class. Copying creates a new instance that
|
||||
@@ -176,7 +176,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
static <T> Object setProperty(PersistentProperty<?> property, T bean, @Nullable Object value) {
|
||||
|
||||
Class<?> type = property.getOwner().getType();
|
||||
KCallable<?> copy = COPY_METHOD_CACHE.computeIfAbsent(type, it -> getCopyMethod(it, property));
|
||||
KCallable<?> copy = copyMethodCache.computeIfAbsent(type, it -> getCopyMethod(it, property));
|
||||
|
||||
if (copy == null) {
|
||||
throw new UnsupportedOperationException(String.format(
|
||||
|
||||
@@ -126,7 +126,7 @@ public class EventPublishingRepositoryProxyPostProcessor implements RepositoryPr
|
||||
*/
|
||||
static class EventPublishingMethod {
|
||||
|
||||
private static Map<Class<?>, EventPublishingMethod> CACHE = new ConcurrentReferenceHashMap<>();
|
||||
private static Map<Class<?>, EventPublishingMethod> cache = new ConcurrentReferenceHashMap<>();
|
||||
private static @SuppressWarnings("null") EventPublishingMethod NONE = new EventPublishingMethod(null, null);
|
||||
|
||||
private final Method publishingMethod;
|
||||
@@ -150,7 +150,7 @@ public class EventPublishingRepositoryProxyPostProcessor implements RepositoryPr
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
|
||||
EventPublishingMethod eventPublishingMethod = CACHE.get(type);
|
||||
EventPublishingMethod eventPublishingMethod = cache.get(type);
|
||||
|
||||
if (eventPublishingMethod != null) {
|
||||
return eventPublishingMethod.orNull();
|
||||
@@ -159,7 +159,7 @@ public class EventPublishingRepositoryProxyPostProcessor implements RepositoryPr
|
||||
EventPublishingMethod result = from(getDetector(type, DomainEvents.class),
|
||||
() -> getDetector(type, AfterDomainEventPublication.class));
|
||||
|
||||
CACHE.put(type, result);
|
||||
cache.put(type, result);
|
||||
|
||||
return result.orNull();
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ExtensionAwareQueryMethodEvaluationContextProvider implements Query
|
||||
*/
|
||||
static class DelegatingMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
private static final Map<Method, Method> METHOD_CACHE = new ConcurrentReferenceHashMap<Method, Method>();
|
||||
private static final Map<Method, Method> methodCache = new ConcurrentReferenceHashMap<Method, Method>();
|
||||
|
||||
private final Object target;
|
||||
private final Map<String, java.util.function.Function<Object, Object>> directMappings = new HashMap<>();
|
||||
@@ -175,7 +175,7 @@ public class ExtensionAwareQueryMethodEvaluationContextProvider implements Query
|
||||
}
|
||||
|
||||
Method method = invocation.getMethod();
|
||||
Method targetMethod = METHOD_CACHE.computeIfAbsent(method,
|
||||
Method targetMethod = methodCache.computeIfAbsent(method,
|
||||
it -> Optional.ofNullable(findTargetMethod(it)).orElse(it));
|
||||
|
||||
Object result = method.equals(targetMethod) ? invocation.proceed()
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
public abstract class ReturnedType {
|
||||
|
||||
private static final Map<CacheKey, ReturnedType> CACHE = new ConcurrentReferenceHashMap<>(32);
|
||||
private static final Map<CacheKey, ReturnedType> cache = new ConcurrentReferenceHashMap<>(32);
|
||||
|
||||
private final Class<?> domainType;
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class ReturnedType {
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(factory, "ProjectionFactory must not be null!");
|
||||
|
||||
return CACHE.computeIfAbsent(CacheKey.of(returnedType, domainType, factory.hashCode()), key -> {
|
||||
return cache.computeIfAbsent(CacheKey.of(returnedType, domainType, factory.hashCode()), key -> {
|
||||
|
||||
return returnedType.isInterface()
|
||||
? new ReturnedInterface(factory.getProjectionInformation(returnedType), domainType)
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class QueryExecutionConverters {
|
||||
private static final Set<Converter<Object, Object>> UNWRAPPERS = new HashSet<Converter<Object, Object>>();
|
||||
private static final Set<Class<?>> ALLOWED_PAGEABLE_TYPES = new HashSet<Class<?>>();
|
||||
private static final Map<Class<?>, ExecutionAdapter> EXECUTION_ADAPTER = new HashMap<>();
|
||||
private static final Map<Class<?>, Boolean> SUPPORTS_CACHE = new ConcurrentReferenceHashMap<>();
|
||||
private static final Map<Class<?>, Boolean> supportsCache = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
@@ -160,7 +160,7 @@ public abstract class QueryExecutionConverters {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
|
||||
return SUPPORTS_CACHE.computeIfAbsent(type, key -> {
|
||||
return supportsCache.computeIfAbsent(type, key -> {
|
||||
|
||||
for (WrapperType candidate : WRAPPER_TYPES) {
|
||||
if (candidate.getType().isAssignableFrom(key)) {
|
||||
@@ -683,7 +683,7 @@ public abstract class QueryExecutionConverters {
|
||||
|
||||
private static final TypeDescriptor STREAMABLE = TypeDescriptor.valueOf(Streamable.class);
|
||||
|
||||
private final Map<TypeDescriptor, Boolean> TARGET_TYPE_CACHE = new ConcurrentHashMap<>();
|
||||
private final Map<TypeDescriptor, Boolean> targetTypeCache = new ConcurrentHashMap<>();
|
||||
private final ConversionService conversionService = DefaultConversionService.getSharedInstance();
|
||||
|
||||
public IterableToStreamableConverter() {}
|
||||
@@ -717,7 +717,7 @@ public abstract class QueryExecutionConverters {
|
||||
return true;
|
||||
}
|
||||
|
||||
return TARGET_TYPE_CACHE.computeIfAbsent(targetType, it -> {
|
||||
return targetTypeCache.computeIfAbsent(targetType, it -> {
|
||||
return conversionService.canConvert(STREAMABLE, targetType);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
|
||||
public static final ClassTypeInformation<Map> MAP = new ClassTypeInformation(Map.class);
|
||||
public static final ClassTypeInformation<Object> OBJECT = new ClassTypeInformation(Object.class);
|
||||
|
||||
private static final Map<Class<?>, ClassTypeInformation<?>> CACHE = new ConcurrentReferenceHashMap<>(64,
|
||||
private static final Map<Class<?>, ClassTypeInformation<?>> cache = new ConcurrentReferenceHashMap<>(64,
|
||||
ReferenceType.WEAK);
|
||||
|
||||
static {
|
||||
Arrays.asList(COLLECTION, LIST, SET, MAP, OBJECT).forEach(it -> CACHE.put(it.getType(), it));
|
||||
Arrays.asList(COLLECTION, LIST, SET, MAP, OBJECT).forEach(it -> cache.put(it.getType(), it));
|
||||
}
|
||||
|
||||
private final Class<S> type;
|
||||
@@ -68,7 +68,7 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
|
||||
return (ClassTypeInformation<S>) CACHE.computeIfAbsent(type, ClassTypeInformation::new);
|
||||
return (ClassTypeInformation<S>) cache.computeIfAbsent(type, ClassTypeInformation::new);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.util.TypeUtils;
|
||||
public class ParameterTypes {
|
||||
|
||||
private static final TypeDescriptor OBJECT_DESCRIPTOR = TypeDescriptor.valueOf(Object.class);
|
||||
private static final ConcurrentMap<List<TypeDescriptor>, ParameterTypes> CACHE = new ConcurrentReferenceHashMap<>();
|
||||
private static final ConcurrentMap<List<TypeDescriptor>, ParameterTypes> cache = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
private final List<TypeDescriptor> types;
|
||||
private final Lazy<Collection<ParameterTypes>> alternatives;
|
||||
@@ -75,7 +75,7 @@ public class ParameterTypes {
|
||||
|
||||
Assert.notNull(types, "Types must not be null!");
|
||||
|
||||
return CACHE.computeIfAbsent(types, ParameterTypes::new);
|
||||
return cache.computeIfAbsent(types, ParameterTypes::new);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user