Genericize some more classes

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@754810 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-03-16 03:35:20 +00:00
parent 950def5b6f
commit 654fb75d80
14 changed files with 175 additions and 176 deletions

View File

@ -56,7 +56,7 @@ public class ArrayUtils {
/**
* An empty immutable <code>Class</code> array.
*/
public static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
/**
* An empty immutable <code>String</code> array.
*/
@ -233,11 +233,11 @@ public class ArrayUtils {
* @throws IllegalArgumentException if the array contains elements other
* than {@link java.util.Map.Entry} and an Array
*/
public static Map toMap(Object[] array) {
public static Map<Object, Object> toMap(Object[] array) {
if (array == null) {
return null;
}
final Map map = new HashMap((int) (array.length * 1.5));
final Map<Object, Object> map = new HashMap<Object, Object>((int) (array.length * 1.5));
for (int i = 0; i < array.length; i++) {
Object object = array[i];
if (object instanceof Map.Entry) {
@ -449,7 +449,7 @@ public class ArrayUtils {
endIndexExclusive = array.length;
}
int newSize = endIndexExclusive - startIndexInclusive;
Class type = array.getClass().getComponentType();
Class<?> type = array.getClass().getComponentType();
if (newSize <= 0) {
return (Object[]) Array.newInstance(type, 0);
}
@ -3229,7 +3229,7 @@ public class ArrayUtils {
* @since 2.1
*/
public static Object[] add(Object[] array, Object element) {
Class type = array != null ? array.getClass() : (element != null ? element.getClass() : Object.class);
Class<?> type = array != null ? array.getClass() : (element != null ? element.getClass() : Object.class);
Object[] newArray = (Object[]) copyArrayGrow1(array, type);
newArray[newArray.length - 1] = element;
return newArray;
@ -3460,7 +3460,7 @@ public class ArrayUtils {
* size 1 array of this type.
* @return A new copy of the array of size 1 greater than the input.
*/
private static Object copyArrayGrow1(Object array, Class newArrayComponentType) {
private static Object copyArrayGrow1(Object array, Class<?> newArrayComponentType) {
if (array != null) {
int arrayLength = Array.getLength(array);
Object newArray = Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);
@ -3499,7 +3499,7 @@ public class ArrayUtils {
* (index < 0 || index > array.length).
*/
public static Object[] add(Object[] array, int index, Object element) {
Class clss = null;
Class<?> clss = null;
if (array != null) {
clss = array.getClass().getComponentType();
} else if (element != null) {
@ -3770,7 +3770,7 @@ public class ArrayUtils {
* @param clss the type of the element being added
* @return A new array containing the existing elements and the new element
*/
private static Object add(Object array, int index, Object element, Class clss) {
private static Object add(Object array, int index, Object element, Class<?> clss) {
if (array == null) {
if (index != 0) {
throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0");

View File

@ -69,7 +69,7 @@ public class ClassUtils {
/**
* Maps primitive <code>Class</code>es to their corresponding wrapper <code>Class</code>.
*/
private static final Map primitiveWrapperMap = new HashMap();
private static final Map<Class<?>, Class<?>> primitiveWrapperMap = new HashMap<Class<?>, Class<?>>();
static {
primitiveWrapperMap.put(Boolean.TYPE, Boolean.class);
primitiveWrapperMap.put(Byte.TYPE, Byte.class);
@ -85,11 +85,11 @@ public class ClassUtils {
/**
* Maps wrapper <code>Class</code>es to their corresponding primitive types.
*/
private static final Map wrapperPrimitiveMap = new HashMap();
private static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = new HashMap<Class<?>, Class<?>>();
static {
for (Iterator it = primitiveWrapperMap.keySet().iterator(); it.hasNext();) {
Class primitiveClass = (Class) it.next();
Class wrapperClass = (Class) primitiveWrapperMap.get(primitiveClass);
for (Iterator<Class<?>> it = primitiveWrapperMap.keySet().iterator(); it.hasNext();) {
Class<?> primitiveClass = it.next();
Class<?> wrapperClass = primitiveWrapperMap.get(primitiveClass);
if (!primitiveClass.equals(wrapperClass)) {
wrapperPrimitiveMap.put(wrapperClass, primitiveClass);
}
@ -99,12 +99,12 @@ public class ClassUtils {
/**
* Maps a primitive class name to its corresponding abbreviation used in array class names.
*/
private static final Map abbreviationMap = new HashMap();
private static final Map<String, String> abbreviationMap = new HashMap<String, String>();
/**
* Maps an abbreviation used in array class names to corresponding primitive class name.
*/
private static final Map reverseAbbreviationMap = new HashMap();
private static final Map<String, String> reverseAbbreviationMap = new HashMap<String, String>();
/**
* Add primitive type abbreviation to maps of abbreviations.
@ -165,7 +165,7 @@ public class ClassUtils {
* @param cls the class to get the short name for.
* @return the class name without the package name or an empty string
*/
public static String getShortClassName(Class cls) {
public static String getShortClassName(Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@ -220,7 +220,7 @@ public class ClassUtils {
* @param cls the class to get the package name for, may be <code>null</code>.
* @return the package name or an empty string
*/
public static String getPackageName(Class cls) {
public static String getPackageName(Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@ -282,20 +282,20 @@ public class ClassUtils {
* @return the <code>List</code> of interfaces in order,
* <code>null</code> if null input
*/
public static List getAllInterfaces(Class cls) {
public static List<Class<?>> getAllInterfaces(Class<?> cls) {
if (cls == null) {
return null;
}
List list = new ArrayList();
List<Class<?>> list = new ArrayList<Class<?>>();
while (cls != null) {
Class[] interfaces = cls.getInterfaces();
Class<?>[] interfaces = cls.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (list.contains(interfaces[i]) == false) {
list.add(interfaces[i]);
}
List superInterfaces = getAllInterfaces(interfaces[i]);
for (Iterator it = superInterfaces.iterator(); it.hasNext();) {
Class intface = (Class) it.next();
List<Class<?>> superInterfaces = getAllInterfaces(interfaces[i]);
for (Iterator<Class<?>> it = superInterfaces.iterator(); it.hasNext();) {
Class<?> intface = it.next();
if (list.contains(intface) == false) {
list.add(intface);
}
@ -320,13 +320,13 @@ public class ClassUtils {
* <code>null</code> if null input
* @throws ClassCastException if classNames contains a non String entry
*/
public static List convertClassNamesToClasses(List classNames) {
public static List<Class<?>> convertClassNamesToClasses(List<String> classNames) {
if (classNames == null) {
return null;
}
List classes = new ArrayList(classNames.size());
for (Iterator it = classNames.iterator(); it.hasNext();) {
String className = (String) it.next();
List<Class<?>> classes = new ArrayList<Class<?>>(classNames.size());
for (Iterator<String> it = classNames.iterator(); it.hasNext();) {
String className = it.next();
try {
classes.add(Class.forName(className));
} catch (Exception ex) {
@ -348,13 +348,13 @@ public class ClassUtils {
* <code>null</code> if null input
* @throws ClassCastException if <code>classes</code> contains a non-<code>Class</code> entry
*/
public static List convertClassesToClassNames(List classes) {
public static List<String> convertClassesToClassNames(List<Class<?>> classes) {
if (classes == null) {
return null;
}
List classNames = new ArrayList(classes.size());
for (Iterator it = classes.iterator(); it.hasNext();) {
Class cls = (Class) it.next();
List<String> classNames = new ArrayList<String>(classes.size());
for (Iterator<Class<?>> it = classes.iterator(); it.hasNext();) {
Class<?> cls = it.next();
if (cls == null) {
classNames.add(null);
} else {
@ -398,7 +398,7 @@ public class ClassUtils {
* @return <code>true</code> if assignment possible
*/
//TODO when we bump the major version we should default autoboxing to true on platforms >= 1.5
public static boolean isAssignable(Class[] classArray, Class[] toClassArray) {
public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray) {
return isAssignable(classArray, toClassArray, false);
}
@ -434,7 +434,7 @@ public class ClassUtils {
* @param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
* @return <code>true</code> if assignment possible
*/
public static boolean isAssignable(Class[] classArray, Class[] toClassArray, boolean autoboxing) {
public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, boolean autoboxing) {
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) {
return false;
}
@ -479,7 +479,7 @@ public class ClassUtils {
* @return <code>true</code> if assignment possible
*/
//TODO when we bump the major version we should default autoboxing to true on platforms >= 1.5
public static boolean isAssignable(Class cls, Class toClass) {
public static boolean isAssignable(Class<?> cls, Class<?> toClass) {
return isAssignable(cls, toClass, false);
}
@ -510,7 +510,7 @@ public class ClassUtils {
* @param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
* @return <code>true</code> if assignment possible
*/
public static boolean isAssignable(Class cls, Class toClass, boolean autoboxing) {
public static boolean isAssignable(Class<?> cls, Class<?> toClass, boolean autoboxing) {
if (toClass == null) {
return false;
}
@ -595,10 +595,10 @@ public class ClassUtils {
* <code>cls</code> is not a primitive. <code>null</code> if null input.
* @since 2.1
*/
public static Class primitiveToWrapper(Class cls) {
Class convertedClass = cls;
public static Class<?> primitiveToWrapper(Class<?> cls) {
Class<?> convertedClass = cls;
if (cls != null && cls.isPrimitive()) {
convertedClass = (Class) primitiveWrapperMap.get(cls);
convertedClass = primitiveWrapperMap.get(cls);
}
return convertedClass;
}
@ -613,7 +613,7 @@ public class ClassUtils {
* Empty array if an empty array passed in.
* @since 2.1
*/
public static Class[] primitivesToWrappers(Class[] classes) {
public static Class<?>[] primitivesToWrappers(Class<?>[] classes) {
if (classes == null) {
return null;
}
@ -622,7 +622,7 @@ public class ClassUtils {
return classes;
}
Class[] convertedClasses = new Class[classes.length];
Class<?>[] convertedClasses = new Class[classes.length];
for (int i = 0; i < classes.length; i++) {
convertedClasses[i] = primitiveToWrapper(classes[i]);
}
@ -645,8 +645,8 @@ public class ClassUtils {
* @see #primitiveToWrapper(Class)
* @since 2.4
*/
public static Class wrapperToPrimitive(Class cls) {
return (Class) wrapperPrimitiveMap.get(cls);
public static Class<?> wrapperToPrimitive(Class<?> cls) {
return wrapperPrimitiveMap.get(cls);
}
/**
@ -663,7 +663,7 @@ public class ClassUtils {
* @see #wrapperToPrimitive(Class)
* @since 2.4
*/
public static Class[] wrappersToPrimitives(Class[] classes) {
public static Class<?>[] wrappersToPrimitives(Class<?>[] classes) {
if (classes == null) {
return null;
}
@ -672,7 +672,7 @@ public class ClassUtils {
return classes;
}
Class[] convertedClasses = new Class[classes.length];
Class<?>[] convertedClasses = new Class[classes.length];
for (int i = 0; i < classes.length; i++) {
convertedClasses[i] = wrapperToPrimitive(classes[i]);
}
@ -688,7 +688,7 @@ public class ClassUtils {
* @return <code>true</code> if the class is an inner or static nested class,
* false if not or <code>null</code>
*/
public static boolean isInnerClass(Class cls) {
public static boolean isInnerClass(Class<?> cls) {
if (cls == null) {
return false;
}
@ -708,9 +708,9 @@ public class ClassUtils {
* @return the class represented by <code>className</code> using the <code>classLoader</code>
* @throws ClassNotFoundException if the class is not found
*/
public static Class getClass(
public static Class<?> getClass(
ClassLoader classLoader, String className, boolean initialize) throws ClassNotFoundException {
Class clazz;
Class<?> clazz;
if (abbreviationMap.containsKey(className)) {
String clsName = "[" + abbreviationMap.get(className);
clazz = Class.forName(clsName, initialize, classLoader).getComponentType();
@ -731,7 +731,7 @@ public class ClassUtils {
* @return the class represented by <code>className</code> using the <code>classLoader</code>
* @throws ClassNotFoundException if the class is not found
*/
public static Class getClass(ClassLoader classLoader, String className) throws ClassNotFoundException {
public static Class<?> getClass(ClassLoader classLoader, String className) throws ClassNotFoundException {
return getClass(classLoader, className, true);
}
@ -745,7 +745,7 @@ public class ClassUtils {
* @return the class represented by <code>className</code> using the current thread's context class loader
* @throws ClassNotFoundException if the class is not found
*/
public static Class getClass(String className) throws ClassNotFoundException {
public static Class<?> getClass(String className) throws ClassNotFoundException {
return getClass(className, true);
}
@ -760,7 +760,7 @@ public class ClassUtils {
* @return the class represented by <code>className</code> using the current thread's context class loader
* @throws ClassNotFoundException if the class is not found
*/
public static Class getClass(String className, boolean initialize) throws ClassNotFoundException {
public static Class<?> getClass(String className, boolean initialize) throws ClassNotFoundException {
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL;
return getClass(loader, className, initialize );
@ -789,7 +789,7 @@ public class ClassUtils {
* @throws NoSuchMethodException if the method is not found in the given class
* or if the metothod doen't conform with the requirements
*/
public static Method getPublicMethod(Class cls, String methodName, Class parameterTypes[])
public static Method getPublicMethod(Class<?> cls, String methodName, Class<?> parameterTypes[])
throws SecurityException, NoSuchMethodException {
Method declaredMethod = cls.getMethod(methodName, parameterTypes);
@ -797,12 +797,12 @@ public class ClassUtils {
return declaredMethod;
}
List candidateClasses = new ArrayList();
List<Class<?>> candidateClasses = new ArrayList<Class<?>>();
candidateClasses.addAll(getAllInterfaces(cls));
candidateClasses.addAll(getAllSuperclasses(cls));
for (Iterator it = candidateClasses.iterator(); it.hasNext(); ) {
Class candidateClass = (Class) it.next();
for (Iterator<Class<?>> it = candidateClasses.iterator(); it.hasNext(); ) {
Class<?> candidateClass = it.next();
if (!Modifier.isPublic(candidateClass.getModifiers())) {
continue;
}
@ -838,7 +838,7 @@ public class ClassUtils {
className = className.substring(0, className.length() - 2);
classNameBuffer.append("[");
}
String abbreviation = (String) abbreviationMap.get(className);
String abbreviation = abbreviationMap.get(className);
if (abbreviation != null) {
classNameBuffer.append(abbreviation);
} else {
@ -858,13 +858,13 @@ public class ClassUtils {
* @return a <code>Class</code> array, <code>null</code> if null array input
* @since 2.4
*/
public static Class[] toClass(Object[] array) {
public static Class<?>[] toClass(Object[] array) {
if (array == null) {
return null;
} else if (array.length == 0) {
return ArrayUtils.EMPTY_CLASS_ARRAY;
}
Class[] classes = new Class[array.length];
Class<?>[] classes = new Class[array.length];
for (int i = 0; i < array.length; i++) {
classes[i] = array[i].getClass();
}
@ -895,7 +895,7 @@ public class ClassUtils {
* @return the canonical name without the package name or an empty string
* @since 2.4
*/
public static String getShortCanonicalName(Class cls) {
public static String getShortCanonicalName(Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@ -939,7 +939,7 @@ public class ClassUtils {
* @return the package name or an empty string
* @since 2.4
*/
public static String getPackageCanonicalName(Class cls) {
public static String getPackageCanonicalName(Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@ -997,8 +997,7 @@ public class ClassUtils {
: className.length());
} else {
if (className.length() > 0) {
className = (String) reverseAbbreviationMap.get(
className.substring(0, 1));
className = reverseAbbreviationMap.get(className.substring(0, 1));
}
}
StringBuffer canonicalClassNameBuffer = new StringBuffer(className);

View File

@ -450,7 +450,7 @@ class Entities {
}
static class PrimitiveEntityMap implements EntityMap {
private final Map mapNameToValue = new HashMap();
private final Map<String, Integer> mapNameToValue = new HashMap<String, Integer>();
private final IntHashMap mapValueToName = new IntHashMap();
@ -482,9 +482,9 @@ class Entities {
}
static abstract class MapIntMap implements Entities.EntityMap {
protected Map mapNameToValue;
protected Map<String, Integer> mapNameToValue;
protected Map mapValueToName;
protected Map<Integer, String> mapValueToName;
/**
* {@inheritDoc}
@ -498,7 +498,7 @@ class Entities {
* {@inheritDoc}
*/
public String name(int value) {
return (String) mapValueToName.get(new Integer(value));
return mapValueToName.get(new Integer(value));
}
/**
@ -518,8 +518,8 @@ class Entities {
* Constructs a new instance of <code>HashEntityMap</code>.
*/
public HashEntityMap() {
mapNameToValue = new HashMap();
mapValueToName = new HashMap();
mapNameToValue = new HashMap<String, Integer>();
mapValueToName = new HashMap<Integer, String>();
}
}
@ -528,8 +528,8 @@ class Entities {
* Constructs a new instance of <code>TreeEntityMap</code>.
*/
public TreeEntityMap() {
mapNameToValue = new TreeMap();
mapValueToName = new TreeMap();
mapNameToValue = new TreeMap<String, Integer>();
mapValueToName = new TreeMap<Integer, String>();
}
}

View File

@ -58,7 +58,7 @@ public class IllegalClassException extends IllegalArgumentException {
* @param actual the actual object
* @since 2.1
*/
public IllegalClassException(Class expected, Object actual) {
public IllegalClassException(Class<?> expected, Object actual) {
super(
"Expected: "
+ safeGetClassName(expected)
@ -72,7 +72,7 @@ public class IllegalClassException extends IllegalArgumentException {
* @param expected the expected type
* @param actual the actual type
*/
public IllegalClassException(Class expected, Class actual) {
public IllegalClassException(Class<?> expected, Class<?> actual) {
super(
"Expected: "
+ safeGetClassName(expected)
@ -96,7 +96,7 @@ public class IllegalClassException extends IllegalArgumentException {
* @param cls a <code>Class</code>
* @return the name of <code>cls</code>, or <code>null</code> if if <code>cls</code> is <code>null</code>.
*/
private static final String safeGetClassName(Class cls) {
private static final String safeGetClassName(Class<?> cls) {
return cls == null ? null : cls.getName();
}

View File

@ -203,7 +203,7 @@ public class CompareToBuilder {
* with <code>lhs</code>
* @since 2.2
*/
public static int reflectionCompare(Object lhs, Object rhs, Collection /*String*/ excludeFields) {
public static int reflectionCompare(Object lhs, Object rhs, Collection<String> excludeFields) {
return reflectionCompare(lhs, rhs, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
}
@ -272,7 +272,7 @@ public class CompareToBuilder {
* @since 2.0
*/
public static int reflectionCompare(Object lhs, Object rhs, boolean compareTransients,
Class reflectUpToClass)
Class<?> reflectUpToClass)
{
return reflectionCompare(lhs, rhs, false, reflectUpToClass, null);
}
@ -313,7 +313,7 @@ public class CompareToBuilder {
Object lhs,
Object rhs,
boolean compareTransients,
Class reflectUpToClass,
Class<?> reflectUpToClass,
String[] excludeFields) {
if (lhs == rhs) {
@ -322,7 +322,7 @@ public class CompareToBuilder {
if (lhs == null || rhs == null) {
throw new NullPointerException();
}
Class lhsClazz = lhs.getClass();
Class<?> lhsClazz = lhs.getClass();
if (!lhsClazz.isInstance(rhs)) {
throw new ClassCastException();
}
@ -349,7 +349,7 @@ public class CompareToBuilder {
private static void reflectionAppend(
Object lhs,
Object rhs,
Class clazz,
Class<?> clazz,
CompareToBuilder builder,
boolean useTransients,
String[] excludeFields) {

View File

@ -144,7 +144,7 @@ public class EqualsBuilder {
* @param excludeFields Collection of String field names to exclude from testing
* @return <code>true</code> if the two Objects have tested equals.
*/
public static boolean reflectionEquals(Object lhs, Object rhs, Collection /*String*/ excludeFields) {
public static boolean reflectionEquals(Object lhs, Object rhs, Collection<String> excludeFields) {
return reflectionEquals(lhs, rhs, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
}
@ -220,7 +220,7 @@ public class EqualsBuilder {
* @return <code>true</code> if the two Objects have tested equals.
* @since 2.0
*/
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class reflectUpToClass) {
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class<?> reflectUpToClass) {
return reflectionEquals(lhs, rhs, testTransients, reflectUpToClass, null);
}
@ -250,7 +250,7 @@ public class EqualsBuilder {
* @return <code>true</code> if the two Objects have tested equals.
* @since 2.0
*/
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class reflectUpToClass,
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class<?> reflectUpToClass,
String[] excludeFields) {
if (lhs == rhs) {
return true;
@ -262,9 +262,9 @@ public class EqualsBuilder {
// class or in classes between the leaf and root.
// If we are not testing transients or a subclass has no ivars,
// then a subclass can test equals to a superclass.
Class lhsClass = lhs.getClass();
Class rhsClass = rhs.getClass();
Class testClass;
Class<?> lhsClass = lhs.getClass();
Class<?> rhsClass = rhs.getClass();
Class<?> testClass;
if (lhsClass.isInstance(rhs)) {
testClass = lhsClass;
if (!rhsClass.isInstance(lhs)) {
@ -313,7 +313,7 @@ public class EqualsBuilder {
private static void reflectionAppend(
Object lhs,
Object rhs,
Class clazz,
Class<?> clazz,
EqualsBuilder builder,
boolean useTransients,
String[] excludeFields) {
@ -375,7 +375,7 @@ public class EqualsBuilder {
this.setEquals(false);
return this;
}
Class lhsClass = lhs.getClass();
Class<?> lhsClass = lhs.getClass();
if (!lhsClass.isArray()) {
if (lhs instanceof java.math.BigDecimal && rhs instanceof java.math.BigDecimal) {
isEquals = (((java.math.BigDecimal)lhs).compareTo((java.math.BigDecimal)rhs) == 0);

View File

@ -102,12 +102,12 @@ public class HashCodeBuilder {
*
* @since 2.3
*/
private static final ThreadLocal registry = new ThreadLocal() {
private static final ThreadLocal<Set<IDKey>> registry = new ThreadLocal<Set<IDKey>>() {
@Override
protected Object initialValue() {
protected Set<IDKey> initialValue() {
// The HashSet implementation is not synchronized,
// which is just what we need here.
return new HashSet();
return new HashSet<IDKey>();
}
};
@ -136,8 +136,8 @@ public class HashCodeBuilder {
* @return Set the registry of objects being traversed
* @since 2.3
*/
static Set getRegistry() {
return (Set) registry.get();
static Set<IDKey> getRegistry() {
return registry.get();
}
/**
@ -171,7 +171,7 @@ public class HashCodeBuilder {
* @param excludeFields
* Collection of String field names to exclude from use in calculation of hash code
*/
private static void reflectionAppend(Object object, Class clazz, HashCodeBuilder builder, boolean useTransients,
private static void reflectionAppend(Object object, Class<?> clazz, HashCodeBuilder builder, boolean useTransients,
String[] excludeFields) {
if (isRegistered(object)) {
return;
@ -305,7 +305,7 @@ public class HashCodeBuilder {
* @return int hash code
*/
public static int reflectionHashCode(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber, Object object,
boolean testTransients, Class reflectUpToClass) {
boolean testTransients, Class<?> reflectUpToClass) {
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, testTransients,
reflectUpToClass, null);
}
@ -356,13 +356,13 @@ public class HashCodeBuilder {
* @since 2.0
*/
public static int reflectionHashCode(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber, Object object,
boolean testTransients, Class reflectUpToClass, String[] excludeFields) {
boolean testTransients, Class<?> reflectUpToClass, String[] excludeFields) {
if (object == null) {
throw new IllegalArgumentException("The object to build a hash code for must not be null");
}
HashCodeBuilder builder = new HashCodeBuilder(initialNonZeroOddNumber, multiplierNonZeroOddNumber);
Class clazz = object.getClass();
Class<?> clazz = object.getClass();
reflectionAppend(object, clazz, builder, testTransients, excludeFields);
while (clazz.getSuperclass() != null && clazz != reflectUpToClass) {
clazz = clazz.getSuperclass();
@ -473,7 +473,7 @@ public class HashCodeBuilder {
* @throws IllegalArgumentException
* if the object is <code>null</code>
*/
public static int reflectionHashCode(Object object, Collection /* String */excludeFields) {
public static int reflectionHashCode(Object object, Collection<String> excludeFields) {
return reflectionHashCode(object, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
}

View File

@ -283,7 +283,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @since 2.1
*/
public static String toString(Object object, ToStringStyle style, boolean outputTransients, boolean outputStatics,
Class reflectUpToClass) {
Class<?> reflectUpToClass) {
return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients, outputStatics)
.toString();
}
@ -310,7 +310,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* The field names to exclude. Null excludes nothing.
* @return The toString value.
*/
public static String toStringExclude(Object object, Collection /*String*/ excludeFieldNames) {
public static String toStringExclude(Object object, Collection<String> excludeFieldNames) {
return toStringExclude(object, toNoNullStringArray(excludeFieldNames));
}
@ -323,7 +323,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* The collection to convert
* @return A new array of Strings.
*/
static String[] toNoNullStringArray(Collection collection) {
static String[] toNoNullStringArray(Collection<String> collection) {
if (collection == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
@ -340,14 +340,14 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @return The given array or a new array without null.
*/
static String[] toNoNullStringArray(Object[] array) {
ArrayList list = new ArrayList(array.length);
ArrayList<String> list = new ArrayList<String>(array.length);
for (int i = 0; i < array.length; i++) {
Object e = array[i];
if (e != null) {
list.add(e.toString());
}
}
return (String[]) list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
return list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}
@ -382,7 +382,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
/**
* The last super class to stop appending fields for.
*/
private Class upToClass = null;
private Class<?> upToClass = null;
/**
* <p>
@ -465,7 +465,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* whether to include static fields
* @since 2.1
*/
public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer, Class reflectUpToClass,
public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer, Class<?> reflectUpToClass,
boolean outputTransients, boolean outputStatics) {
super(object, style, buffer);
this.setUpToClass(reflectUpToClass);
@ -519,7 +519,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @param clazz
* The class of object parameter
*/
protected void appendFieldsIn(Class clazz) {
protected void appendFieldsIn(Class<?> clazz) {
if (clazz.isArray()) {
this.reflectionAppendArray(this.getObject());
return;
@ -560,7 +560,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
*
* @return The last super class to stop appending fields for.
*/
public Class getUpToClass() {
public Class<?> getUpToClass() {
return this.upToClass;
}
@ -671,7 +671,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @param clazz
* The last super class to stop appending fields for.
*/
public void setUpToClass(Class clazz) {
public void setUpToClass(Class<?> clazz) {
this.upToClass = clazz;
}
@ -687,7 +687,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
if (this.getObject() == null) {
return this.getStyle().getNullText();
}
Class clazz = this.getObject().getClass();
Class<?> clazz = this.getObject().getClass();
this.appendFieldsIn(clazz);
while (clazz.getSuperclass() != null && clazz != this.getUpToClass()) {
clazz = clazz.getSuperclass();

View File

@ -133,12 +133,12 @@ public abstract class ToStringStyle implements Serializable {
* to detect cyclical object references and avoid infinite loops.
* </p>
*/
private static final ThreadLocal registry = new ThreadLocal() {
private static final ThreadLocal<Set<Object>> registry = new ThreadLocal<Set<Object>>() {
@Override
protected Object initialValue() {
protected Set<Object> initialValue() {
// The HashSet implementation is not synchronized,
// which is just what we need here.
return new HashSet();
return new HashSet<Object>();
}
};
@ -150,8 +150,8 @@ public abstract class ToStringStyle implements Serializable {
*
* @return Set the registry of objects being traversed
*/
static Set getRegistry() {
return (Set) registry.get();
static Set<Object> getRegistry() {
return registry.get();
}
/**

View File

@ -81,7 +81,7 @@ public class ConstructorUtils {
*
* @see #invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])
*/
public static Object invokeConstructor(Class cls, Object arg)
public static Object invokeConstructor(Class<?> cls, Object arg)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException {
return invokeConstructor(cls, new Object[] { arg });
@ -105,13 +105,13 @@ public class ConstructorUtils {
*
* @see #invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])
*/
public static Object invokeConstructor(Class cls, Object[] args)
public static Object invokeConstructor(Class<?> cls, Object[] args)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException {
if (null == args) {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
Class parameterTypes[] = new Class[args.length];
Class<?> parameterTypes[] = new Class[args.length];
for (int i = 0; i < args.length; i++) {
parameterTypes[i] = args[i].getClass();
}
@ -135,8 +135,8 @@ public class ConstructorUtils {
* @throws InstantiationException thrown on the constructor's invocation
* @see Constructor#newInstance
*/
public static Object invokeConstructor(Class cls, Object[] args,
Class[] parameterTypes) throws NoSuchMethodException,
public static Object invokeConstructor(Class<?> cls, Object[] args,
Class<?>[] parameterTypes) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException,
InstantiationException {
if (parameterTypes == null) {
@ -172,7 +172,7 @@ public class ConstructorUtils {
*
* @see #invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])
*/
public static Object invokeExactConstructor(Class cls, Object arg)
public static Object invokeExactConstructor(Class<?> cls, Object arg)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException {
return invokeExactConstructor(cls, new Object[] { arg });
@ -196,14 +196,14 @@ public class ConstructorUtils {
*
* @see #invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])
*/
public static Object invokeExactConstructor(Class cls, Object[] args)
public static Object invokeExactConstructor(Class<?> cls, Object[] args)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException {
if (null == args) {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class parameterTypes[] = new Class[arguments];
Class<?> parameterTypes[] = new Class[arguments];
for (int i = 0; i < arguments; i++) {
parameterTypes[i] = args[i].getClass();
}
@ -228,8 +228,8 @@ public class ConstructorUtils {
* @throws InstantiationException thrown on the constructor's invocation
* @see Constructor#newInstance
*/
public static Object invokeExactConstructor(Class cls, Object[] args,
Class[] parameterTypes) throws NoSuchMethodException,
public static Object invokeExactConstructor(Class<?> cls, Object[] args,
Class<?>[] parameterTypes) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException,
InstantiationException {
if (args == null) {
@ -255,8 +255,8 @@ public class ConstructorUtils {
* @see Class#getConstructor
* @see #getAccessibleConstructor(java.lang.reflect.Constructor)
*/
public static Constructor getAccessibleConstructor(Class cls,
Class parameterType) {
public static Constructor getAccessibleConstructor(Class<?> cls,
Class<?> parameterType) {
return getAccessibleConstructor(cls, new Class[] { parameterType });
}
@ -268,8 +268,8 @@ public class ConstructorUtils {
* @see Class#getConstructor
* @see #getAccessibleConstructor(java.lang.reflect.Constructor)
*/
public static Constructor getAccessibleConstructor(Class cls,
Class[] parameterTypes) {
public static Constructor getAccessibleConstructor(Class<?> cls,
Class<?>[] parameterTypes) {
try {
return getAccessibleConstructor(cls.getConstructor(parameterTypes));
} catch (NoSuchMethodException e) {
@ -304,8 +304,8 @@ public class ConstructorUtils {
* @param parameterTypes find method with compatible parameters
* @return a valid Constructor object. If there's no matching constructor, returns <code>null</code>.
*/
public static Constructor getMatchingAccessibleConstructor(Class cls,
Class[] parameterTypes) {
public static Constructor getMatchingAccessibleConstructor(Class<?> cls,
Class<?>[] parameterTypes) {
// see if we can find the constructor directly
// most of the time this works and it's much faster
try {

View File

@ -56,7 +56,7 @@ public class FieldUtils {
* @return the Field object
* @throws IllegalArgumentException if the class or field name is null
*/
public static Field getField(Class cls, String fieldName) {
public static Field getField(Class<?> cls, String fieldName) {
Field field = getField(cls, fieldName, false);
MemberUtils.setAccessibleWorkaround(field);
return field;
@ -74,7 +74,7 @@ public class FieldUtils {
* @return the Field object
* @throws IllegalArgumentException if the class or field name is null
*/
public static Field getField(final Class cls, String fieldName, boolean forceAccess) {
public static Field getField(final Class<?> cls, String fieldName, boolean forceAccess) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
@ -95,7 +95,7 @@ public class FieldUtils {
// implementedinterface public
// check up the superclass hierarchy
for (Class acls = cls; acls != null; acls = acls.getSuperclass()) {
for (Class<?> acls = cls; acls != null; acls = acls.getSuperclass()) {
try {
Field field = acls.getDeclaredField(fieldName);
// getDeclaredField checks for non-public scopes as well
@ -116,10 +116,10 @@ public class FieldUtils {
// incase there is a public supersuperclass field hidden by a private/package
// superclass field.
Field match = null;
for (Iterator intf = ClassUtils.getAllInterfaces(cls).iterator(); intf
for (Iterator<Class<?>> intf = ClassUtils.getAllInterfaces(cls).iterator(); intf
.hasNext();) {
try {
Field test = ((Class) intf.next()).getField(fieldName);
Field test = ((Class<?>) intf.next()).getField(fieldName);
if (match != null) {
throw new IllegalArgumentException(
"Reference to field "
@ -145,7 +145,7 @@ public class FieldUtils {
* @return the Field object
* @throws IllegalArgumentException if the class or field name is null
*/
public static Field getDeclaredField(Class cls, String fieldName) {
public static Field getDeclaredField(Class<?> cls, String fieldName) {
return getDeclaredField(cls, fieldName, false);
}
@ -160,7 +160,7 @@ public class FieldUtils {
* @return the Field object
* @throws IllegalArgumentException if the class or field name is null
*/
public static Field getDeclaredField(Class cls, String fieldName, boolean forceAccess) {
public static Field getDeclaredField(Class<?> cls, String fieldName, boolean forceAccess) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
@ -221,7 +221,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the field is not accessible
*/
public static Object readStaticField(Class cls, String fieldName) throws IllegalAccessException {
public static Object readStaticField(Class<?> cls, String fieldName) throws IllegalAccessException {
return readStaticField(cls, fieldName, false);
}
@ -236,7 +236,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the field is not made accessible
*/
public static Object readStaticField(Class cls, String fieldName, boolean forceAccess) throws IllegalAccessException {
public static Object readStaticField(Class<?> cls, String fieldName, boolean forceAccess) throws IllegalAccessException {
Field field = getField(cls, fieldName, forceAccess);
if (field == null) {
throw new IllegalArgumentException("Cannot locate field " + fieldName + " on " + cls);
@ -255,7 +255,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the field is not accessible
*/
public static Object readDeclaredStaticField(Class cls, String fieldName) throws IllegalAccessException {
public static Object readDeclaredStaticField(Class<?> cls, String fieldName) throws IllegalAccessException {
return readDeclaredStaticField(cls, fieldName, false);
}
@ -272,7 +272,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the field is not made accessible
*/
public static Object readDeclaredStaticField(Class cls, String fieldName, boolean forceAccess)
public static Object readDeclaredStaticField(Class<?> cls, String fieldName, boolean forceAccess)
throws IllegalAccessException {
Field field = getDeclaredField(cls, fieldName, forceAccess);
if (field == null) {
@ -343,7 +343,7 @@ public class FieldUtils {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
}
Class cls = target.getClass();
Class<?> cls = target.getClass();
Field field = getField(cls, fieldName, forceAccess);
if (field == null) {
throw new IllegalArgumentException("Cannot locate field " + fieldName + " on " + cls);
@ -381,7 +381,7 @@ public class FieldUtils {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
}
Class cls = target.getClass();
Class<?> cls = target.getClass();
Field field = getDeclaredField(cls, fieldName, forceAccess);
if (field == null) {
throw new IllegalArgumentException("Cannot locate declared field " + cls.getName() + "." + fieldName);
@ -429,7 +429,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field cannot be located or is not static
* @throws IllegalAccessException if the field is not public or is final
*/
public static void writeStaticField(Class cls, String fieldName, Object value) throws IllegalAccessException {
public static void writeStaticField(Class<?> cls, String fieldName, Object value) throws IllegalAccessException {
writeStaticField(cls, fieldName, value, false);
}
@ -444,7 +444,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field cannot be located or is not static
* @throws IllegalAccessException if the field is not made accessible or is final
*/
public static void writeStaticField(Class cls, String fieldName, Object value, boolean forceAccess)
public static void writeStaticField(Class<?> cls, String fieldName, Object value, boolean forceAccess)
throws IllegalAccessException {
Field field = getField(cls, fieldName, forceAccess);
if (field == null) {
@ -462,7 +462,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field cannot be located or is not static
* @throws IllegalAccessException if the field is not public or is final
*/
public static void writeDeclaredStaticField(Class cls, String fieldName, Object value)
public static void writeDeclaredStaticField(Class<?> cls, String fieldName, Object value)
throws IllegalAccessException {
writeDeclaredStaticField(cls, fieldName, value, false);
}
@ -478,7 +478,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field cannot be located or is not static
* @throws IllegalAccessException if the field is not made accessible or is final
*/
public static void writeDeclaredStaticField(Class cls, String fieldName, Object value, boolean forceAccess)
public static void writeDeclaredStaticField(Class<?> cls, String fieldName, Object value, boolean forceAccess)
throws IllegalAccessException {
Field field = getDeclaredField(cls, fieldName, forceAccess);
if (field == null) {
@ -551,7 +551,7 @@ public class FieldUtils {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
}
Class cls = target.getClass();
Class<?> cls = target.getClass();
Field field = getField(cls, fieldName, forceAccess);
if (field == null) {
throw new IllegalArgumentException("Cannot locate declared field " + cls.getName() + "." + fieldName);
@ -588,7 +588,7 @@ public class FieldUtils {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
}
Class cls = target.getClass();
Class<?> cls = target.getClass();
Field field = getDeclaredField(cls, fieldName, forceAccess);
if (field == null) {
throw new IllegalArgumentException("Cannot locate declared field " + cls.getName() + "." + fieldName);

View File

@ -54,7 +54,7 @@ abstract class MemberUtils {
}
/** Array of primitive number types ordered by "promotability" */
private static final Class[] ORDERED_PRIMITIVE_TYPES = { Byte.TYPE,
private static final Class<?>[] ORDERED_PRIMITIVE_TYPES = { Byte.TYPE,
Short.TYPE, Character.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE,
Double.TYPE };
@ -128,7 +128,7 @@ abstract class MemberUtils {
* @param actual the runtime parameter types to match against <code>left</code>/<code>right</code>
* @return int consistent with <code>compare</code> semantics
*/
static int compareParameterTypes(Class[] left, Class[] right, Class[] actual) {
static int compareParameterTypes(Class<?>[] left, Class<?>[] right, Class<?>[] actual) {
float leftCost = getTotalTransformationCost(actual, left);
float rightCost = getTotalTransformationCost(actual, right);
return leftCost < rightCost ? -1 : rightCost < leftCost ? 1 : 0;
@ -141,11 +141,11 @@ abstract class MemberUtils {
* @param destArgs The destination arguments
* @return The total transformation cost
*/
private static float getTotalTransformationCost(Class[] srcArgs,
Class[] destArgs) {
private static float getTotalTransformationCost(Class<?>[] srcArgs,
Class<?>[] destArgs) {
float totalCost = 0.0f;
for (int i = 0; i < srcArgs.length; i++) {
Class srcClass, destClass;
Class<?> srcClass, destClass;
srcClass = srcArgs[i];
destClass = destArgs[i];
totalCost += getObjectTransformationCost(srcClass, destClass);
@ -161,8 +161,8 @@ abstract class MemberUtils {
* @param destClass The destination class
* @return The cost of transforming an object
*/
private static float getObjectTransformationCost(Class srcClass,
Class destClass) {
private static float getObjectTransformationCost(Class<?> srcClass,
Class<?> destClass) {
if (destClass.isPrimitive()) {
return getPrimitivePromotionCost(srcClass, destClass);
}
@ -197,10 +197,10 @@ abstract class MemberUtils {
* @param destClass the (primitive) destination class
* @return The cost of promoting the primitive
*/
private static float getPrimitivePromotionCost(final Class srcClass,
final Class destClass) {
private static float getPrimitivePromotionCost(final Class<?> srcClass,
final Class<?> destClass) {
float cost = 0.0f;
Class cls = srcClass;
Class<?> cls = srcClass;
if (!cls.isPrimitive()) {
// slight unwrapping penalty
cost += 0.1f;

View File

@ -533,7 +533,7 @@ public class StrSubstitutor {
* @return the length change that occurs, unless priorVariables is null when the int
* represents a boolean flag as to whether any change occurred.
*/
private int substitute(StrBuilder buf, int offset, int length, List priorVariables) {
private int substitute(StrBuilder buf, int offset, int length, List<String> priorVariables) {
StrMatcher prefixMatcher = getVariablePrefixMatcher();
StrMatcher suffixMatcher = getVariableSuffixMatcher();
char escape = getEscapeChar();
@ -575,7 +575,7 @@ public class StrSubstitutor {
// on the first call initialize priorVariables
if (priorVariables == null) {
priorVariables = new ArrayList();
priorVariables = new ArrayList<String>();
priorVariables.add(new String(chars, offset, length));
}
@ -618,7 +618,7 @@ public class StrSubstitutor {
* @param varName the variable name to check
* @param priorVariables the list of prior variables
*/
private void checkCyclicSubstitution(String varName, List priorVariables) {
private void checkCyclicSubstitution(String varName, List<String> priorVariables) {
if (priorVariables.contains(varName) == false) {
return;
}

View File

@ -108,11 +108,11 @@ public class FastDateFormat extends Format {
//@GuardedBy("this")
private static String cDefaultPattern; // lazily initialised by getInstance()
private static final Map cInstanceCache = new HashMap(7);
private static final Map cDateInstanceCache = new HashMap(7);
private static final Map cTimeInstanceCache = new HashMap(7);
private static final Map cDateTimeInstanceCache = new HashMap(7);
private static final Map cTimeZoneDisplayCache = new HashMap(7);
private static final Map<FastDateFormat, FastDateFormat> cInstanceCache = new HashMap<FastDateFormat, FastDateFormat>(7);
private static final Map<Object, FastDateFormat> cDateInstanceCache = new HashMap<Object, FastDateFormat>(7);
private static final Map<Object, FastDateFormat> cTimeInstanceCache = new HashMap<Object, FastDateFormat>(7);
private static final Map<Object, FastDateFormat> cDateTimeInstanceCache = new HashMap<Object, FastDateFormat>(7);
private static final Map<Object, String> cTimeZoneDisplayCache = new HashMap<Object, String>(7);
/**
* The pattern.
@ -211,7 +211,7 @@ public class FastDateFormat extends Format {
*/
public static synchronized FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) {
FastDateFormat emptyFormat = new FastDateFormat(pattern, timeZone, locale);
FastDateFormat format = (FastDateFormat) cInstanceCache.get(emptyFormat);
FastDateFormat format = cInstanceCache.get(emptyFormat);
if (format == null) {
format = emptyFormat;
format.init(); // convert shell format into usable one
@ -278,7 +278,7 @@ public class FastDateFormat extends Format {
* pattern defined
*/
public static synchronized FastDateFormat getDateInstance(int style, TimeZone timeZone, Locale locale) {
Object key = new Integer(style);
Object key = Integer.valueOf(style);
if (timeZone != null) {
key = new Pair(key, timeZone);
}
@ -289,7 +289,7 @@ public class FastDateFormat extends Format {
key = new Pair(key, locale);
FastDateFormat format = (FastDateFormat) cDateInstanceCache.get(key);
FastDateFormat format = cDateInstanceCache.get(key);
if (format == null) {
try {
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateInstance(style, locale);
@ -363,7 +363,7 @@ public class FastDateFormat extends Format {
* pattern defined
*/
public static synchronized FastDateFormat getTimeInstance(int style, TimeZone timeZone, Locale locale) {
Object key = new Integer(style);
Object key = Integer.valueOf(style);
if (timeZone != null) {
key = new Pair(key, timeZone);
}
@ -371,7 +371,7 @@ public class FastDateFormat extends Format {
key = new Pair(key, locale);
}
FastDateFormat format = (FastDateFormat) cTimeInstanceCache.get(key);
FastDateFormat format = cTimeInstanceCache.get(key);
if (format == null) {
if (locale == null) {
locale = Locale.getDefault();
@ -457,7 +457,7 @@ public class FastDateFormat extends Format {
public static synchronized FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone,
Locale locale) {
Object key = new Pair(new Integer(dateStyle), new Integer(timeStyle));
Object key = new Pair(Integer.valueOf(dateStyle), Integer.valueOf(timeStyle));
if (timeZone != null) {
key = new Pair(key, timeZone);
}
@ -466,7 +466,7 @@ public class FastDateFormat extends Format {
}
key = new Pair(key, locale);
FastDateFormat format = (FastDateFormat) cDateTimeInstanceCache.get(key);
FastDateFormat format = cDateTimeInstanceCache.get(key);
if (format == null) {
try {
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance(dateStyle, timeStyle,
@ -495,7 +495,7 @@ public class FastDateFormat extends Format {
*/
static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) {
Object key = new TimeZoneDisplayKey(tz, daylight, style, locale);
String value = (String) cTimeZoneDisplayCache.get(key);
String value = cTimeZoneDisplayCache.get(key);
if (value == null) {
// This is a very slow call, so cache the results.
value = tz.getDisplayName(daylight, style, locale);
@ -555,8 +555,8 @@ public class FastDateFormat extends Format {
* <p>Initializes the instance for first use.</p>
*/
protected void init() {
List rulesList = parsePattern();
mRules = (Rule[]) rulesList.toArray(new Rule[rulesList.size()]);
List<Rule> rulesList = parsePattern();
mRules = rulesList.toArray(new Rule[rulesList.size()]);
int len = 0;
for (int i=mRules.length; --i >= 0; ) {
@ -574,9 +574,9 @@ public class FastDateFormat extends Format {
* @return a <code>List</code> of Rule objects
* @throws IllegalArgumentException if pattern is invalid
*/
protected List parsePattern() {
protected List<Rule> parsePattern() {
DateFormatSymbols symbols = new DateFormatSymbols(mLocale);
List rules = new ArrayList();
List<Rule> rules = new ArrayList<Rule>();
String[] ERAs = symbols.getEras();
String[] months = symbols.getMonths();