Skip to content

Commit b041634

Browse files
committed
Upper case internal constants
1 parent 6140da5 commit b041634

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

src/main/java/org/apache/commons/lang3/ClassUtils.java

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -93,59 +93,59 @@ public enum Interfaces {
9393
/**
9494
* Maps names of primitives to their corresponding primitive {@link Class}es.
9595
*/
96-
private static final Map<String, Class<?>> namePrimitiveMap = new HashMap<>();
96+
private static final Map<String, Class<?>> NAME_PRIMITIVE_MAP = new HashMap<>();
9797

9898
static {
99-
namePrimitiveMap.put(Boolean.TYPE.getName(), Boolean.TYPE);
100-
namePrimitiveMap.put(Byte.TYPE.getName(), Byte.TYPE);
101-
namePrimitiveMap.put(Character.TYPE.getName(), Character.TYPE);
102-
namePrimitiveMap.put(Double.TYPE.getName(), Double.TYPE);
103-
namePrimitiveMap.put(Float.TYPE.getName(), Float.TYPE);
104-
namePrimitiveMap.put(Integer.TYPE.getName(), Integer.TYPE);
105-
namePrimitiveMap.put(Long.TYPE.getName(), Long.TYPE);
106-
namePrimitiveMap.put(Short.TYPE.getName(), Short.TYPE);
107-
namePrimitiveMap.put(Void.TYPE.getName(), Void.TYPE);
99+
NAME_PRIMITIVE_MAP.put(Boolean.TYPE.getName(), Boolean.TYPE);
100+
NAME_PRIMITIVE_MAP.put(Byte.TYPE.getName(), Byte.TYPE);
101+
NAME_PRIMITIVE_MAP.put(Character.TYPE.getName(), Character.TYPE);
102+
NAME_PRIMITIVE_MAP.put(Double.TYPE.getName(), Double.TYPE);
103+
NAME_PRIMITIVE_MAP.put(Float.TYPE.getName(), Float.TYPE);
104+
NAME_PRIMITIVE_MAP.put(Integer.TYPE.getName(), Integer.TYPE);
105+
NAME_PRIMITIVE_MAP.put(Long.TYPE.getName(), Long.TYPE);
106+
NAME_PRIMITIVE_MAP.put(Short.TYPE.getName(), Short.TYPE);
107+
NAME_PRIMITIVE_MAP.put(Void.TYPE.getName(), Void.TYPE);
108108
}
109109

110110
/**
111111
* Maps primitive {@link Class}es to their corresponding wrapper {@link Class}.
112112
*/
113-
private static final Map<Class<?>, Class<?>> primitiveWrapperMap = new HashMap<>();
113+
private static final Map<Class<?>, Class<?>> PRIMITIVE_WRAPPER_MAP = new HashMap<>();
114114

115115
static {
116-
primitiveWrapperMap.put(Boolean.TYPE, Boolean.class);
117-
primitiveWrapperMap.put(Byte.TYPE, Byte.class);
118-
primitiveWrapperMap.put(Character.TYPE, Character.class);
119-
primitiveWrapperMap.put(Short.TYPE, Short.class);
120-
primitiveWrapperMap.put(Integer.TYPE, Integer.class);
121-
primitiveWrapperMap.put(Long.TYPE, Long.class);
122-
primitiveWrapperMap.put(Double.TYPE, Double.class);
123-
primitiveWrapperMap.put(Float.TYPE, Float.class);
124-
primitiveWrapperMap.put(Void.TYPE, Void.TYPE);
116+
PRIMITIVE_WRAPPER_MAP.put(Boolean.TYPE, Boolean.class);
117+
PRIMITIVE_WRAPPER_MAP.put(Byte.TYPE, Byte.class);
118+
PRIMITIVE_WRAPPER_MAP.put(Character.TYPE, Character.class);
119+
PRIMITIVE_WRAPPER_MAP.put(Short.TYPE, Short.class);
120+
PRIMITIVE_WRAPPER_MAP.put(Integer.TYPE, Integer.class);
121+
PRIMITIVE_WRAPPER_MAP.put(Long.TYPE, Long.class);
122+
PRIMITIVE_WRAPPER_MAP.put(Double.TYPE, Double.class);
123+
PRIMITIVE_WRAPPER_MAP.put(Float.TYPE, Float.class);
124+
PRIMITIVE_WRAPPER_MAP.put(Void.TYPE, Void.TYPE);
125125
}
126126

127127
/**
128128
* Maps wrapper {@link Class}es to their corresponding primitive types.
129129
*/
130-
private static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = new HashMap<>();
130+
private static final Map<Class<?>, Class<?>> WRAPPER_PRIMITIVE_MAP = new HashMap<>();
131131

132132
static {
133-
primitiveWrapperMap.forEach((primitiveClass, wrapperClass) -> {
133+
PRIMITIVE_WRAPPER_MAP.forEach((primitiveClass, wrapperClass) -> {
134134
if (!primitiveClass.equals(wrapperClass)) {
135-
wrapperPrimitiveMap.put(wrapperClass, primitiveClass);
135+
WRAPPER_PRIMITIVE_MAP.put(wrapperClass, primitiveClass);
136136
}
137137
});
138138
}
139139

140140
/**
141141
* Maps a primitive class name to its corresponding abbreviation used in array class names.
142142
*/
143-
private static final Map<String, String> abbreviationMap;
143+
private static final Map<String, String> ABBREVIATION_MAP;
144144

145145
/**
146146
* Maps an abbreviation used in array class names to corresponding primitive class name.
147147
*/
148-
private static final Map<String, String> reverseAbbreviationMap;
148+
private static final Map<String, String> REVERSE_ABBREVIATION_MAP;
149149

150150
/** Feed abbreviation maps. */
151151
static {
@@ -158,8 +158,8 @@ public enum Interfaces {
158158
map.put(Byte.TYPE.getName(), "B");
159159
map.put(Double.TYPE.getName(), "D");
160160
map.put(Character.TYPE.getName(), "C");
161-
abbreviationMap = Collections.unmodifiableMap(map);
162-
reverseAbbreviationMap = Collections.unmodifiableMap(map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)));
161+
ABBREVIATION_MAP = Collections.unmodifiableMap(map);
162+
REVERSE_ABBREVIATION_MAP = Collections.unmodifiableMap(map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)));
163163
}
164164

165165
/**
@@ -496,7 +496,7 @@ private static String getCanonicalName(final String name) {
496496
if (className.startsWith("L")) {
497497
className = className.substring(1, className.endsWith(";") ? className.length() - 1 : className.length());
498498
} else if (!className.isEmpty()) {
499-
className = reverseAbbreviationMap.get(className.substring(0, 1));
499+
className = REVERSE_ABBREVIATION_MAP.get(className.substring(0, 1));
500500
}
501501
final StringBuilder canonicalClassNameBuffer = new StringBuilder(className.length() + dim * 2);
502502
canonicalClassNameBuffer.append(className);
@@ -761,7 +761,7 @@ public static String getPackageName(String className) {
761761
* @return the primitive class.
762762
*/
763763
static Class<?> getPrimitiveClass(final String className) {
764-
return namePrimitiveMap.get(className);
764+
return NAME_PRIMITIVE_MAP.get(className);
765765
}
766766

767767
/**
@@ -1023,8 +1023,8 @@ public static String getShortClassName(String className) {
10231023
className = className.substring(1, className.length() - 1);
10241024
}
10251025

1026-
if (reverseAbbreviationMap.containsKey(className)) {
1027-
className = reverseAbbreviationMap.get(className);
1026+
if (REVERSE_ABBREVIATION_MAP.containsKey(className)) {
1027+
className = REVERSE_ABBREVIATION_MAP.get(className);
10281028
}
10291029
}
10301030

@@ -1441,7 +1441,7 @@ public static boolean isPrimitiveOrWrapper(final Class<?> type) {
14411441
* @since 3.1
14421442
*/
14431443
public static boolean isPrimitiveWrapper(final Class<?> type) {
1444-
return wrapperPrimitiveMap.containsKey(type);
1444+
return WRAPPER_PRIMITIVE_MAP.containsKey(type);
14451445
}
14461446

14471447
/**
@@ -1491,7 +1491,7 @@ public static Class<?>[] primitivesToWrappers(final Class<?>... classes) {
14911491
public static Class<?> primitiveToWrapper(final Class<?> cls) {
14921492
Class<?> convertedClass = cls;
14931493
if (cls != null && cls.isPrimitive()) {
1494-
convertedClass = primitiveWrapperMap.get(cls);
1494+
convertedClass = PRIMITIVE_WRAPPER_MAP.get(cls);
14951495
}
14961496
return convertedClass;
14971497
}
@@ -1513,7 +1513,7 @@ private static String toCanonicalName(final String className) {
15131513
canonicalName = canonicalName.substring(0, canonicalName.length() - 2);
15141514
classNameBuffer.append("[");
15151515
}
1516-
final String abbreviation = abbreviationMap.get(canonicalName);
1516+
final String abbreviation = ABBREVIATION_MAP.get(canonicalName);
15171517
if (abbreviation != null) {
15181518
classNameBuffer.append(abbreviation);
15191519
} else {
@@ -1615,7 +1615,7 @@ public static Class<?>[] wrappersToPrimitives(final Class<?>... classes) {
16151615
* @since 2.4
16161616
*/
16171617
public static Class<?> wrapperToPrimitive(final Class<?> cls) {
1618-
return wrapperPrimitiveMap.get(cls);
1618+
return WRAPPER_PRIMITIVE_MAP.get(cls);
16191619
}
16201620

16211621
/**

0 commit comments

Comments
 (0)