You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/01/22 08:07:46 UTC
svn commit: r1436768 [9/13] - in /commons/proper/lang/trunk/src:
main/java/org/apache/commons/lang3/
main/java/org/apache/commons/lang3/builder/
main/java/org/apache/commons/lang3/concurrent/
main/java/org/apache/commons/lang3/event/ main/java/org/apac...
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java Tue Jan 22 07:07:42 2013
@@ -53,7 +53,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(final Class<?> cls, final String fieldName) {
Field field = getField(cls, fieldName, false);
MemberUtils.setAccessibleWorkaround(field);
return field;
@@ -71,7 +71,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, final String fieldName, final boolean forceAccess) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
@@ -137,7 +137,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(final Class<?> cls, final String fieldName) {
return getDeclaredField(cls, fieldName, false);
}
@@ -152,7 +152,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(final Class<?> cls, final String fieldName, final boolean forceAccess) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
@@ -183,7 +183,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null or not static
* @throws IllegalAccessException if the field is not accessible
*/
- public static Object readStaticField(Field field) throws IllegalAccessException {
+ public static Object readStaticField(final Field field) throws IllegalAccessException {
return readStaticField(field, false);
}
@@ -196,7 +196,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null or not static
* @throws IllegalAccessException if the field is not made accessible
*/
- public static Object readStaticField(Field field, boolean forceAccess) throws IllegalAccessException {
+ public static Object readStaticField(final Field field, final boolean forceAccess) throws IllegalAccessException {
if (field == null) {
throw new IllegalArgumentException("The field must not be null");
}
@@ -214,7 +214,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
* @throws IllegalAccessException if the field is not accessible
*/
- public static Object readStaticField(Class<?> cls, String fieldName) throws IllegalAccessException {
+ public static Object readStaticField(final Class<?> cls, final String fieldName) throws IllegalAccessException {
return readStaticField(cls, fieldName, false);
}
@@ -229,7 +229,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
* @throws IllegalAccessException if the field is not made accessible
*/
- public static Object readStaticField(Class<?> cls, String fieldName, boolean forceAccess)
+ public static Object readStaticField(final Class<?> cls, final String fieldName, final boolean forceAccess)
throws IllegalAccessException {
Field field = getField(cls, fieldName, forceAccess);
if (field == null) {
@@ -249,7 +249,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
* @throws IllegalAccessException if the field is not accessible
*/
- public static Object readDeclaredStaticField(Class<?> cls, String fieldName) throws IllegalAccessException {
+ public static Object readDeclaredStaticField(final Class<?> cls, final String fieldName) throws IllegalAccessException {
return readDeclaredStaticField(cls, fieldName, false);
}
@@ -266,7 +266,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
* @throws IllegalAccessException if the field is not made accessible
*/
- public static Object readDeclaredStaticField(Class<?> cls, String fieldName, boolean forceAccess)
+ public static Object readDeclaredStaticField(final Class<?> cls, final String fieldName, final boolean forceAccess)
throws IllegalAccessException {
Field field = getDeclaredField(cls, fieldName, forceAccess);
if (field == null) {
@@ -284,7 +284,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null
* @throws IllegalAccessException if the field is not accessible
*/
- public static Object readField(Field field, Object target) throws IllegalAccessException {
+ public static Object readField(final Field field, final Object target) throws IllegalAccessException {
return readField(field, target, false);
}
@@ -298,7 +298,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null
* @throws IllegalAccessException if the field is not made accessible
*/
- public static Object readField(Field field, Object target, boolean forceAccess) throws IllegalAccessException {
+ public static Object readField(final Field field, final Object target, final boolean forceAccess) throws IllegalAccessException {
if (field == null) {
throw new IllegalArgumentException("The field must not be null");
}
@@ -318,7 +318,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the named field is not public
*/
- public static Object readField(Object target, String fieldName) throws IllegalAccessException {
+ public static Object readField(final Object target, final String fieldName) throws IllegalAccessException {
return readField(target, fieldName, false);
}
@@ -333,7 +333,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the named field is not made accessible
*/
- public static Object readField(Object target, String fieldName, boolean forceAccess) throws IllegalAccessException {
+ public static Object readField(final Object target, final String fieldName, final boolean forceAccess) throws IllegalAccessException {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
}
@@ -354,7 +354,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the class or field name is null
* @throws IllegalAccessException if the named field is not public
*/
- public static Object readDeclaredField(Object target, String fieldName) throws IllegalAccessException {
+ public static Object readDeclaredField(final Object target, final String fieldName) throws IllegalAccessException {
return readDeclaredField(target, fieldName, false);
}
@@ -371,7 +371,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
* @throws IllegalAccessException if the field is not made accessible
*/
- public static Object readDeclaredField(Object target, String fieldName, boolean forceAccess)
+ public static Object readDeclaredField(final Object target, final String fieldName, final boolean forceAccess)
throws IllegalAccessException {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
@@ -392,7 +392,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null or not static
* @throws IllegalAccessException if the field is not public or is final
*/
- public static void writeStaticField(Field field, Object value) throws IllegalAccessException {
+ public static void writeStaticField(final Field field, final Object value) throws IllegalAccessException {
writeStaticField(field, value, false);
}
@@ -406,7 +406,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null or not static
* @throws IllegalAccessException if the field is not made accessible or is final
*/
- public static void writeStaticField(Field field, Object value, boolean forceAccess) throws IllegalAccessException {
+ public static void writeStaticField(final Field field, final Object value, final boolean forceAccess) throws IllegalAccessException {
if (field == null) {
throw new IllegalArgumentException("The field must not be null");
}
@@ -424,7 +424,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(final Class<?> cls, final String fieldName, final Object value) throws IllegalAccessException {
writeStaticField(cls, fieldName, value, false);
}
@@ -439,7 +439,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(final Class<?> cls, final String fieldName, final Object value, final boolean forceAccess)
throws IllegalAccessException {
Field field = getField(cls, fieldName, forceAccess);
if (field == null) {
@@ -457,7 +457,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(final Class<?> cls, final String fieldName, final Object value)
throws IllegalAccessException {
writeDeclaredStaticField(cls, fieldName, value, false);
}
@@ -473,7 +473,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(final Class<?> cls, final String fieldName, final Object value, final boolean forceAccess)
throws IllegalAccessException {
Field field = getDeclaredField(cls, fieldName, forceAccess);
if (field == null) {
@@ -491,7 +491,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null
* @throws IllegalAccessException if the field is not accessible or is final
*/
- public static void writeField(Field field, Object target, Object value) throws IllegalAccessException {
+ public static void writeField(final Field field, final Object target, final Object value) throws IllegalAccessException {
writeField(field, target, value, false);
}
@@ -506,7 +506,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if the field is null
* @throws IllegalAccessException if the field is not made accessible or is final
*/
- public static void writeField(Field field, Object target, Object value, boolean forceAccess)
+ public static void writeField(final Field field, final Object target, final Object value, final boolean forceAccess)
throws IllegalAccessException {
if (field == null) {
throw new IllegalArgumentException("The field must not be null");
@@ -527,7 +527,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
* @throws IllegalAccessException if the field is not accessible
*/
- public static void writeField(Object target, String fieldName, Object value) throws IllegalAccessException {
+ public static void writeField(final Object target, final String fieldName, final Object value) throws IllegalAccessException {
writeField(target, fieldName, value, false);
}
@@ -542,7 +542,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
* @throws IllegalAccessException if the field is not made accessible
*/
- public static void writeField(Object target, String fieldName, Object value, boolean forceAccess)
+ public static void writeField(final Object target, final String fieldName, final Object value, final boolean forceAccess)
throws IllegalAccessException {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
@@ -564,7 +564,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
* @throws IllegalAccessException if the field is not made accessible
*/
- public static void writeDeclaredField(Object target, String fieldName, Object value) throws IllegalAccessException {
+ public static void writeDeclaredField(final Object target, final String fieldName, final Object value) throws IllegalAccessException {
writeDeclaredField(target, fieldName, value, false);
}
@@ -579,7 +579,7 @@ public class FieldUtils {
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
* @throws IllegalAccessException if the field is not made accessible
*/
- public static void writeDeclaredField(Object target, String fieldName, Object value, boolean forceAccess)
+ public static void writeDeclaredField(final Object target, final String fieldName, final Object value, final boolean forceAccess)
throws IllegalAccessException {
if (target == null) {
throw new IllegalArgumentException("target object must not be null");
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java Tue Jan 22 07:07:42 2013
@@ -51,7 +51,7 @@ abstract class MemberUtils {
* accepted.
* @param o the AccessibleObject to set as accessible
*/
- static void setAccessibleWorkaround(AccessibleObject o) {
+ static void setAccessibleWorkaround(final AccessibleObject o) {
if (o == null || o.isAccessible()) {
return;
}
@@ -71,7 +71,7 @@ abstract class MemberUtils {
* @param modifiers to test
* @return true unless package/protected/private modifier detected
*/
- static boolean isPackageAccess(int modifiers) {
+ static boolean isPackageAccess(final int modifiers) {
return (modifiers & ACCESS_TEST) == 0;
}
@@ -80,7 +80,7 @@ abstract class MemberUtils {
* @param m Member to check
* @return true if <code>m</code> is accessible
*/
- static boolean isAccessible(Member m) {
+ static boolean isAccessible(final Member m) {
return m != null && Modifier.isPublic(m.getModifiers()) && !m.isSynthetic();
}
@@ -96,7 +96,7 @@ abstract class MemberUtils {
* <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(final Class<?>[] left, final Class<?>[] right, final Class<?>[] actual) {
float leftCost = getTotalTransformationCost(actual, left);
float rightCost = getTotalTransformationCost(actual, right);
return leftCost < rightCost ? -1 : rightCost < leftCost ? 1 : 0;
@@ -109,7 +109,7 @@ 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(final Class<?>[] srcArgs, final Class<?>[] destArgs) {
float totalCost = 0.0f;
for (int i = 0; i < srcArgs.length; i++) {
Class<?> srcClass, destClass;
@@ -128,7 +128,7 @@ 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, final Class<?> destClass) {
if (destClass.isPrimitive()) {
return getPrimitivePromotionCost(srcClass, destClass);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java Tue Jan 22 07:07:42 2013
@@ -80,7 +80,7 @@ public class MethodUtils {
* @throws InvocationTargetException wraps an exception thrown by the method invoked
* @throws IllegalAccessException if the requested method is not accessible via reflection
*/
- public static Object invokeMethod(Object object, String methodName,
+ public static Object invokeMethod(final Object object, final String methodName,
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
if (args == null) {
@@ -109,7 +109,7 @@ public class MethodUtils {
* @throws InvocationTargetException wraps an exception thrown by the method invoked
* @throws IllegalAccessException if the requested method is not accessible via reflection
*/
- public static Object invokeMethod(Object object, String methodName,
+ public static Object invokeMethod(final Object object, final String methodName,
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
@@ -147,7 +147,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
- public static Object invokeExactMethod(Object object, String methodName,
+ public static Object invokeExactMethod(final Object object, final String methodName,
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
if (args == null) {
@@ -176,7 +176,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
- public static Object invokeExactMethod(Object object, String methodName,
+ public static Object invokeExactMethod(final Object object, final String methodName,
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
@@ -215,7 +215,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
- public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
+ public static Object invokeExactStaticMethod(final Class<?> cls, final String methodName,
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
@@ -257,7 +257,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
- public static Object invokeStaticMethod(Class<?> cls, String methodName,
+ public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
if (args == null) {
@@ -289,7 +289,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
- public static Object invokeStaticMethod(Class<?> cls, String methodName,
+ public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
@@ -326,7 +326,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
- public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
+ public static Object invokeExactStaticMethod(final Class<?> cls, final String methodName,
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
if (args == null) {
@@ -348,8 +348,8 @@ public class MethodUtils {
* @param parameterTypes with these parameters types
* @return The accessible method
*/
- public static Method getAccessibleMethod(Class<?> cls, String methodName,
- Class<?>... parameterTypes) {
+ public static Method getAccessibleMethod(final Class<?> cls, final String methodName,
+ final Class<?>... parameterTypes) {
try {
return getAccessibleMethod(cls.getMethod(methodName,
parameterTypes));
@@ -400,8 +400,8 @@ public class MethodUtils {
* @param parameterTypes The parameter type signatures
* @return the accessible method or <code>null</code> if not found
*/
- private static Method getAccessibleMethodFromSuperclass(Class<?> cls,
- String methodName, Class<?>... parameterTypes) {
+ private static Method getAccessibleMethodFromSuperclass(final Class<?> cls,
+ final String methodName, final Class<?>... parameterTypes) {
Class<?> parentClass = cls.getSuperclass();
while (parentClass != null) {
if (Modifier.isPublic(parentClass.getModifiers())) {
@@ -432,7 +432,7 @@ public class MethodUtils {
* @return the accessible method or <code>null</code> if not found
*/
private static Method getAccessibleMethodFromInterfaceNest(Class<?> cls,
- String methodName, Class<?>... parameterTypes) {
+ final String methodName, final Class<?>... parameterTypes) {
Method method = null;
// Search up the superclass chain
@@ -489,8 +489,8 @@ public class MethodUtils {
* @param parameterTypes find method with most compatible parameters
* @return The accessible method
*/
- public static Method getMatchingAccessibleMethod(Class<?> cls,
- String methodName, Class<?>... parameterTypes) {
+ public static Method getMatchingAccessibleMethod(final Class<?> cls,
+ final String methodName, final Class<?>... parameterTypes) {
try {
Method method = cls.getMethod(methodName, parameterTypes);
MemberUtils.setAccessibleWorkaround(method);
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java Tue Jan 22 07:07:42 2013
@@ -61,7 +61,7 @@ public class TypeUtils {
* @param toType the target type
* @return <code>true</code> if <code>type</code> is assignable to <code>toType</code>.
*/
- public static boolean isAssignable(Type type, Type toType) {
+ public static boolean isAssignable(final Type type, final Type toType) {
return isAssignable(type, toType, null);
}
@@ -74,8 +74,8 @@ public class TypeUtils {
* @param typeVarAssigns optional map of type variable assignments
* @return <code>true</code> if <code>type</code> is assignable to <code>toType</code>.
*/
- private static boolean isAssignable(Type type, Type toType,
- Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static boolean isAssignable(final Type type, final Type toType,
+ final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (toType == null || toType instanceof Class<?>) {
return isAssignable(type, (Class<?>) toType);
}
@@ -109,7 +109,7 @@ public class TypeUtils {
* @param toClass the target class
* @return true if <code>type</code> is assignable to <code>toClass</code>.
*/
- private static boolean isAssignable(Type type, Class<?> toClass) {
+ private static boolean isAssignable(final Type type, final Class<?> toClass) {
if (type == null) {
// consistency with ClassUtils.isAssignable() behavior
return toClass == null || !toClass.isPrimitive();
@@ -176,8 +176,8 @@ public class TypeUtils {
* @param typeVarAssigns a map with type variables
* @return true if <code>type</code> is assignable to <code>toType</code>.
*/
- private static boolean isAssignable(Type type, ParameterizedType toParameterizedType,
- Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static boolean isAssignable(final Type type, final ParameterizedType toParameterizedType,
+ final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type == null) {
return true;
}
@@ -234,7 +234,7 @@ public class TypeUtils {
return true;
}
- private static Type unrollVariableAssignments(TypeVariable<?> var, Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static Type unrollVariableAssignments(TypeVariable<?> var, final Map<TypeVariable<?>, Type> typeVarAssigns) {
Type result;
do {
result = typeVarAssigns.get(var);
@@ -257,8 +257,8 @@ public class TypeUtils {
* @return true if <code>type</code> is assignable to
* <code>toGenericArrayType</code>.
*/
- private static boolean isAssignable(Type type, GenericArrayType toGenericArrayType,
- Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static boolean isAssignable(final Type type, final GenericArrayType toGenericArrayType,
+ final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type == null) {
return true;
}
@@ -333,8 +333,8 @@ public class TypeUtils {
* @return true if <code>type</code> is assignable to
* <code>toWildcardType</code>.
*/
- private static boolean isAssignable(Type type, WildcardType toWildcardType,
- Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static boolean isAssignable(final Type type, final WildcardType toWildcardType,
+ final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type == null) {
return true;
}
@@ -422,8 +422,8 @@ public class TypeUtils {
* @return true if <code>type</code> is assignable to
* <code>toTypeVariable</code>.
*/
- private static boolean isAssignable(Type type, TypeVariable<?> toTypeVariable,
- Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static boolean isAssignable(final Type type, final TypeVariable<?> toTypeVariable,
+ final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type == null) {
return true;
}
@@ -468,7 +468,7 @@ public class TypeUtils {
* @return the replaced type
* @throws IllegalArgumentException if the type cannot be substituted
*/
- private static Type substituteTypeVariables(Type type, Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
Type replacementType = typeVarAssigns.get(type);
@@ -494,7 +494,7 @@ public class TypeUtils {
* harvest the parameters.
* @return a map of the type arguments to their respective type variables.
*/
- public static Map<TypeVariable<?>, Type> getTypeArguments(ParameterizedType type) {
+ public static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType type) {
return getTypeArguments(type, getRawType(type), null);
}
@@ -530,7 +530,7 @@ public class TypeUtils {
* in the inheritance hierarchy from <code>type</code> to
* <code>toClass</code> inclusive.
*/
- public static Map<TypeVariable<?>, Type> getTypeArguments(Type type, Class<?> toClass) {
+ public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
return getTypeArguments(type, toClass, null);
}
@@ -542,8 +542,8 @@ public class TypeUtils {
* @param subtypeVarAssigns a map with type variables
* @return the map with type arguments
*/
- private static Map<TypeVariable<?>, Type> getTypeArguments(Type type, Class<?> toClass,
- Map<TypeVariable<?>, Type> subtypeVarAssigns) {
+ private static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass,
+ final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
if (type instanceof Class<?>) {
return getTypeArguments((Class<?>) type, toClass, subtypeVarAssigns);
}
@@ -595,8 +595,8 @@ public class TypeUtils {
* @return the map with type arguments
*/
private static Map<TypeVariable<?>, Type> getTypeArguments(
- ParameterizedType parameterizedType, Class<?> toClass,
- Map<TypeVariable<?>, Type> subtypeVarAssigns) {
+ final ParameterizedType parameterizedType, final Class<?> toClass,
+ final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
Class<?> cls = getRawType(parameterizedType);
// make sure they're assignable
@@ -647,8 +647,8 @@ public class TypeUtils {
* @param subtypeVarAssigns a map with type variables
* @return the map with type arguments
*/
- private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, Class<?> toClass,
- Map<TypeVariable<?>, Type> subtypeVarAssigns) {
+ private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
+ final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
// make sure they're assignable
if (!isAssignable(cls, toClass)) {
return null;
@@ -707,8 +707,8 @@ public class TypeUtils {
* type variables in each type in the inheritance hierarchy from
* <code>type</code> to <code>toClass</code> inclusive.
*/
- public static Map<TypeVariable<?>, Type> determineTypeArguments(Class<?> cls,
- ParameterizedType superType) {
+ public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
+ final ParameterizedType superType) {
Class<?> superClass = getRawType(superType);
// compatibility check
@@ -747,8 +747,8 @@ public class TypeUtils {
* @param parameterizedType the parameterized type
* @param typeVarAssigns the map to be filled
*/
- private static <T> void mapTypeVariablesToArguments(Class<T> cls,
- ParameterizedType parameterizedType, Map<TypeVariable<?>, Type> typeVarAssigns) {
+ private static <T> void mapTypeVariablesToArguments(final Class<T> cls,
+ final ParameterizedType parameterizedType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
// capture the type variables from the owner type that have assignments
Type ownerType = parameterizedType.getOwnerType();
@@ -794,7 +794,7 @@ public class TypeUtils {
* @param superClass the super class
* @return the closes parent type
*/
- private static Type getClosestParentType(Class<?> cls, Class<?> superClass) {
+ private static Type getClosestParentType(final Class<?> cls, final Class<?> superClass) {
// only look at the interfaces if the super class is also an interface
if (superClass.isInterface()) {
// get the generic interfaces of the subject class
@@ -842,7 +842,7 @@ public class TypeUtils {
* @param type the target type
* @return true of <code>value</code> is an instance of <code>type</code>.
*/
- public static boolean isInstance(Object value, Type type) {
+ public static boolean isInstance(final Object value, final Type type) {
if (type == null) {
return false;
}
@@ -872,7 +872,7 @@ public class TypeUtils {
* @return an array containing the values from <code>bounds</code> minus the
* redundant types.
*/
- public static Type[] normalizeUpperBounds(Type[] bounds) {
+ public static Type[] normalizeUpperBounds(final Type[] bounds) {
// don't bother if there's only one (or none) type
if (bounds.length < 2) {
return bounds;
@@ -907,7 +907,7 @@ public class TypeUtils {
* @param typeVariable the subject type variable
* @return a non-empty array containing the bounds of the type variable.
*/
- public static Type[] getImplicitBounds(TypeVariable<?> typeVariable) {
+ public static Type[] getImplicitBounds(final TypeVariable<?> typeVariable) {
Type[] bounds = typeVariable.getBounds();
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
@@ -923,7 +923,7 @@ public class TypeUtils {
* @return a non-empty array containing the upper bounds of the wildcard
* type.
*/
- public static Type[] getImplicitUpperBounds(WildcardType wildcardType) {
+ public static Type[] getImplicitUpperBounds(final WildcardType wildcardType) {
Type[] bounds = wildcardType.getUpperBounds();
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
@@ -938,7 +938,7 @@ public class TypeUtils {
* @return a non-empty array containing the lower bounds of the wildcard
* type.
*/
- public static Type[] getImplicitLowerBounds(WildcardType wildcardType) {
+ public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) {
Type[] bounds = wildcardType.getLowerBounds();
return bounds.length == 0 ? new Type[] { null } : bounds;
@@ -957,7 +957,7 @@ public class TypeUtils {
* @return whether or not the types can be assigned to their respective type
* variables.
*/
- public static boolean typesSatisfyVariables(Map<TypeVariable<?>, Type> typeVarAssigns) {
+ public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) {
// all types must be assignable to all the bounds of the their mapped
// type variable.
for (Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) {
@@ -982,7 +982,7 @@ public class TypeUtils {
* @return the corresponding {@code Class} object
* @throws IllegalStateException if the conversion fails
*/
- private static Class<?> getRawType(ParameterizedType parameterizedType) {
+ private static Class<?> getRawType(final ParameterizedType parameterizedType) {
Type rawType = parameterizedType.getRawType();
// check if raw type is a Class object
@@ -1009,7 +1009,7 @@ public class TypeUtils {
* @return the resolved <code>Class</code> object or <code>null</code> if
* the type could not be resolved
*/
- public static Class<?> getRawType(Type type, Type assigningType) {
+ public static Class<?> getRawType(final Type type, final Type assigningType) {
if (type instanceof Class<?>) {
// it is raw, no problem
return (Class<?>) type;
@@ -1078,7 +1078,7 @@ public class TypeUtils {
* @param type the type to be checked
* @return <code>true</code> if <code>type</code> is an array class or a {@link GenericArrayType}.
*/
- public static boolean isArrayType(Type type) {
+ public static boolean isArrayType(final Type type) {
return type instanceof GenericArrayType || type instanceof Class<?> && ((Class<?>) type).isArray();
}
@@ -1087,7 +1087,7 @@ public class TypeUtils {
* @param type the type to be checked
* @return component type or null if type is not an array type
*/
- public static Type getArrayComponentType(Type type) {
+ public static Type getArrayComponentType(final Type type) {
if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>) type;
return clazz.isArray() ? clazz.getComponentType() : null;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java Tue Jan 22 07:07:42 2013
@@ -49,7 +49,7 @@ public class CompositeFormat extends For
* @param parser implementation
* @param formatter implementation
*/
- public CompositeFormat(Format parser, Format formatter) {
+ public CompositeFormat(final Format parser, final Format formatter) {
this.parser = parser;
this.formatter = formatter;
}
@@ -64,8 +64,8 @@ public class CompositeFormat extends For
* @see Format#format(Object, StringBuffer, FieldPosition)
*/
@Override // Therefore has to use StringBuffer
- public StringBuffer format(Object obj, StringBuffer toAppendTo,
- FieldPosition pos) {
+ public StringBuffer format(final Object obj, final StringBuffer toAppendTo,
+ final FieldPosition pos) {
return formatter.format(obj, toAppendTo, pos);
}
@@ -80,7 +80,7 @@ public class CompositeFormat extends For
* @see Format#parseObject(String, ParsePosition)
*/
@Override
- public Object parseObject(String source, ParsePosition pos) {
+ public Object parseObject(final String source, final ParsePosition pos) {
return parser.parseObject(source, pos);
}
@@ -109,7 +109,7 @@ public class CompositeFormat extends For
* @return A reformatted String
* @throws ParseException thrown by parseObject(String) call
*/
- public String reformat(String input) throws ParseException {
+ public String reformat(final String input) throws ParseException {
return format(parseObject(input));
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java Tue Jan 22 07:07:42 2013
@@ -87,7 +87,7 @@ public class ExtendedMessageFormat exten
* @param pattern the pattern to use, not null
* @throws IllegalArgumentException in case of a bad pattern.
*/
- public ExtendedMessageFormat(String pattern) {
+ public ExtendedMessageFormat(final String pattern) {
this(pattern, Locale.getDefault());
}
@@ -98,7 +98,7 @@ public class ExtendedMessageFormat exten
* @param locale the locale to use, not null
* @throws IllegalArgumentException in case of a bad pattern.
*/
- public ExtendedMessageFormat(String pattern, Locale locale) {
+ public ExtendedMessageFormat(final String pattern, final Locale locale) {
this(pattern, locale, null);
}
@@ -109,7 +109,7 @@ public class ExtendedMessageFormat exten
* @param registry the registry of format factories, may be null
* @throws IllegalArgumentException in case of a bad pattern.
*/
- public ExtendedMessageFormat(String pattern, Map<String, ? extends FormatFactory> registry) {
+ public ExtendedMessageFormat(final String pattern, final Map<String, ? extends FormatFactory> registry) {
this(pattern, Locale.getDefault(), registry);
}
@@ -121,7 +121,7 @@ public class ExtendedMessageFormat exten
* @param registry the registry of format factories, may be null
* @throws IllegalArgumentException in case of a bad pattern.
*/
- public ExtendedMessageFormat(String pattern, Locale locale, Map<String, ? extends FormatFactory> registry) {
+ public ExtendedMessageFormat(final String pattern, final Locale locale, final Map<String, ? extends FormatFactory> registry) {
super(DUMMY_PATTERN);
setLocale(locale);
this.registry = registry;
@@ -142,7 +142,7 @@ public class ExtendedMessageFormat exten
* @param pattern String
*/
@Override
- public final void applyPattern(String pattern) {
+ public final void applyPattern(final String pattern) {
if (registry == null) {
super.applyPattern(pattern);
toPattern = super.toPattern();
@@ -216,7 +216,7 @@ public class ExtendedMessageFormat exten
* @throws UnsupportedOperationException
*/
@Override
- public void setFormat(int formatElementIndex, Format newFormat) {
+ public void setFormat(final int formatElementIndex, final Format newFormat) {
throw new UnsupportedOperationException();
}
@@ -228,7 +228,7 @@ public class ExtendedMessageFormat exten
* @throws UnsupportedOperationException
*/
@Override
- public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) {
+ public void setFormatByArgumentIndex(final int argumentIndex, final Format newFormat) {
throw new UnsupportedOperationException();
}
@@ -239,7 +239,7 @@ public class ExtendedMessageFormat exten
* @throws UnsupportedOperationException
*/
@Override
- public void setFormats(Format[] newFormats) {
+ public void setFormats(final Format[] newFormats) {
throw new UnsupportedOperationException();
}
@@ -250,7 +250,7 @@ public class ExtendedMessageFormat exten
* @throws UnsupportedOperationException
*/
@Override
- public void setFormatsByArgumentIndex(Format[] newFormats) {
+ public void setFormatsByArgumentIndex(final Format[] newFormats) {
throw new UnsupportedOperationException();
}
@@ -261,7 +261,7 @@ public class ExtendedMessageFormat exten
* @return true if this object equals the other, otherwise false
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -303,7 +303,7 @@ public class ExtendedMessageFormat exten
* @param desc String
* @return Format
*/
- private Format getFormat(String desc) {
+ private Format getFormat(final String desc) {
if (registry != null) {
String name = desc;
String args = null;
@@ -327,7 +327,7 @@ public class ExtendedMessageFormat exten
* @param pos current parse position
* @return argument index
*/
- private int readArgumentIndex(String pattern, ParsePosition pos) {
+ private int readArgumentIndex(final String pattern, final ParsePosition pos) {
int start = pos.getIndex();
seekNonWs(pattern, pos);
StringBuilder result = new StringBuilder();
@@ -369,7 +369,7 @@ public class ExtendedMessageFormat exten
* @param pos current parse position
* @return Format description String
*/
- private String parseFormatDescription(String pattern, ParsePosition pos) {
+ private String parseFormatDescription(final String pattern, final ParsePosition pos) {
int start = pos.getIndex();
seekNonWs(pattern, pos);
int text = pos.getIndex();
@@ -401,7 +401,7 @@ public class ExtendedMessageFormat exten
* @param customPatterns The custom patterns to re-insert, if any
* @return full pattern
*/
- private String insertFormats(String pattern, ArrayList<String> customPatterns) {
+ private String insertFormats(final String pattern, final ArrayList<String> customPatterns) {
if (!containsElements(customPatterns)) {
return pattern;
}
@@ -444,7 +444,7 @@ public class ExtendedMessageFormat exten
* @param pattern String to read
* @param pos current position
*/
- private void seekNonWs(String pattern, ParsePosition pos) {
+ private void seekNonWs(final String pattern, final ParsePosition pos) {
int len = 0;
char[] buffer = pattern.toCharArray();
do {
@@ -459,7 +459,7 @@ public class ExtendedMessageFormat exten
* @param pos ParsePosition
* @return <code>pos</code>
*/
- private ParsePosition next(ParsePosition pos) {
+ private ParsePosition next(final ParsePosition pos) {
pos.setIndex(pos.getIndex() + 1);
return pos;
}
@@ -474,8 +474,8 @@ public class ExtendedMessageFormat exten
* @param escapingOn whether to process escaped quotes
* @return <code>appendTo</code>
*/
- private StringBuilder appendQuotedString(String pattern, ParsePosition pos,
- StringBuilder appendTo, boolean escapingOn) {
+ private StringBuilder appendQuotedString(final String pattern, final ParsePosition pos,
+ final StringBuilder appendTo, final boolean escapingOn) {
int start = pos.getIndex();
char[] c = pattern.toCharArray();
if (escapingOn && c[start] == QUOTE) {
@@ -511,8 +511,8 @@ public class ExtendedMessageFormat exten
* @param pos current parse position
* @param escapingOn whether to process escaped quotes
*/
- private void getQuotedString(String pattern, ParsePosition pos,
- boolean escapingOn) {
+ private void getQuotedString(final String pattern, final ParsePosition pos,
+ final boolean escapingOn) {
appendQuotedString(pattern, pos, null, escapingOn);
}
@@ -521,7 +521,7 @@ public class ExtendedMessageFormat exten
* @param coll to check
* @return <code>true</code> if some Object was found, <code>false</code> otherwise.
*/
- private boolean containsElements(Collection<?> coll) {
+ private boolean containsElements(final Collection<?> coll) {
if (coll == null || coll.isEmpty()) {
return false;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java Tue Jan 22 07:07:42 2013
@@ -62,7 +62,7 @@ public class FormattableUtils {
* @param formattable the instance to convert to a string, not null
* @return the resulting string, not null
*/
- public static String toString(Formattable formattable) {
+ public static String toString(final Formattable formattable) {
return String.format(SIMPLEST_FORMAT, formattable);
}
@@ -78,8 +78,8 @@ public class FormattableUtils {
* @param precision the precision of the output, see {@code Formattable}
* @return the {@code formatter} instance, not null
*/
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
- int precision) {
+ public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
+ final int precision) {
return append(seq, formatter, flags, width, precision, ' ', null);
}
@@ -95,8 +95,8 @@ public class FormattableUtils {
* @param padChar the pad character to use
* @return the {@code formatter} instance, not null
*/
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
- int precision, char padChar) {
+ public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
+ final int precision, final char padChar) {
return append(seq, formatter, flags, width, precision, padChar, null);
}
@@ -113,8 +113,8 @@ public class FormattableUtils {
* empty causes a hard truncation
* @return the {@code formatter} instance, not null
*/
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
- int precision, CharSequence ellipsis) {
+ public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
+ final int precision, final CharSequence ellipsis) {
return append(seq, formatter, flags, width, precision, ' ', ellipsis);
}
@@ -131,8 +131,8 @@ public class FormattableUtils {
* empty causes a hard truncation
* @return the {@code formatter} instance, not null
*/
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
- int precision, char padChar, CharSequence ellipsis) {
+ public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
+ final int precision, final char padChar, final CharSequence ellipsis) {
Validate.isTrue(ellipsis == null || precision < 0 || ellipsis.length() <= precision,
"Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, Integer.valueOf(precision));
StringBuilder buf = new StringBuilder(seq);