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 [3/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/BitField.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BitField.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BitField.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BitField.java Tue Jan 22 07:07:42 2013
@@ -34,7 +34,7 @@ public class BitField {
* BitField. Bits that are set in this mask are the bits
* that this BitField operates on
*/
- public BitField(int mask) {
+ public BitField(final int mask) {
_mask = mask;
int count = 0;
int bit_pattern = mask;
@@ -62,7 +62,7 @@ public class BitField {
* in
* @return the selected bits, shifted right appropriately
*/
- public int getValue(int holder) {
+ public int getValue(final int holder) {
return getRawValue(holder) >> _shift_count;
}
@@ -80,7 +80,7 @@ public class BitField {
* interested in
* @return the selected bits, shifted right appropriately
*/
- public short getShortValue(short holder) {
+ public short getShortValue(final short holder) {
return (short) getValue(holder);
}
@@ -91,7 +91,7 @@ public class BitField {
* interested in
* @return the selected bits
*/
- public int getRawValue(int holder) {
+ public int getRawValue(final int holder) {
return holder & _mask;
}
@@ -102,7 +102,7 @@ public class BitField {
* interested in
* @return the selected bits
*/
- public short getShortRawValue(short holder) {
+ public short getShortRawValue(final short holder) {
return (short) getRawValue(holder);
}
@@ -119,7 +119,7 @@ public class BitField {
* @return {@code true} if any of the bits are set,
* else {@code false}
*/
- public boolean isSet(int holder) {
+ public boolean isSet(final int holder) {
return (holder & _mask) != 0;
}
@@ -135,7 +135,7 @@ public class BitField {
* @return {@code true} if all of the bits are set,
* else {@code false}
*/
- public boolean isAllSet(int holder) {
+ public boolean isAllSet(final int holder) {
return (holder & _mask) == _mask;
}
@@ -149,7 +149,7 @@ public class BitField {
* @return the value of holder with the bits from the value
* parameter replacing the old bits
*/
- public int setValue(int holder, int value) {
+ public int setValue(final int holder, final int value) {
return (holder & ~_mask) | ((value << _shift_count) & _mask);
}
@@ -163,7 +163,7 @@ public class BitField {
* @return the value of holder with the bits from the value
* parameter replacing the old bits
*/
- public short setShortValue(short holder, short value) {
+ public short setShortValue(final short holder, final short value) {
return (short) setValue(holder, value);
}
@@ -175,7 +175,7 @@ public class BitField {
* @return the value of holder with the specified bits cleared
* (set to {@code 0})
*/
- public int clear(int holder) {
+ public int clear(final int holder) {
return holder & ~_mask;
}
@@ -187,7 +187,7 @@ public class BitField {
* @return the value of holder with the specified bits cleared
* (set to {@code 0})
*/
- public short clearShort(short holder) {
+ public short clearShort(final short holder) {
return (short) clear(holder);
}
@@ -200,7 +200,7 @@ public class BitField {
* @return the value of holder with the specified bits cleared
* (set to {@code 0})
*/
- public byte clearByte(byte holder) {
+ public byte clearByte(final byte holder) {
return (byte) clear(holder);
}
@@ -212,7 +212,7 @@ public class BitField {
* @return the value of holder with the specified bits set
* to {@code 1}
*/
- public int set(int holder) {
+ public int set(final int holder) {
return holder | _mask;
}
@@ -224,7 +224,7 @@ public class BitField {
* @return the value of holder with the specified bits set
* to {@code 1}
*/
- public short setShort(short holder) {
+ public short setShort(final short holder) {
return (short) set(holder);
}
@@ -237,7 +237,7 @@ public class BitField {
* @return the value of holder with the specified bits set
* to {@code 1}
*/
- public byte setByte(byte holder) {
+ public byte setByte(final byte holder) {
return (byte) set(holder);
}
@@ -250,7 +250,7 @@ public class BitField {
* @return the value of holder with the specified bits set or
* cleared
*/
- public int setBoolean(int holder, boolean flag) {
+ public int setBoolean(final int holder, final boolean flag) {
return flag ? set(holder) : clear(holder);
}
@@ -263,7 +263,7 @@ public class BitField {
* @return the value of holder with the specified bits set or
* cleared
*/
- public short setShortBoolean(short holder, boolean flag) {
+ public short setShortBoolean(final short holder, final boolean flag) {
return flag ? setShort(holder) : clearShort(holder);
}
@@ -276,7 +276,7 @@ public class BitField {
* @return the value of holder with the specified bits set or
* cleared
*/
- public byte setByteBoolean(byte holder, boolean flag) {
+ public byte setByteBoolean(final byte holder, final boolean flag) {
return flag ? setByte(holder) : clearByte(holder);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BooleanUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BooleanUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BooleanUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/BooleanUtils.java Tue Jan 22 07:07:42 2013
@@ -60,7 +60,7 @@ public class BooleanUtils {
* @param bool the Boolean to negate, may be null
* @return the negated Boolean, or {@code null} if {@code null} input
*/
- public static Boolean negate(Boolean bool) {
+ public static Boolean negate(final Boolean bool) {
if (bool == null) {
return null;
}
@@ -83,7 +83,7 @@ public class BooleanUtils {
* @return {@code true} only if the input is non-null and true
* @since 2.1
*/
- public static boolean isTrue(Boolean bool) {
+ public static boolean isTrue(final Boolean bool) {
return Boolean.TRUE.equals(bool);
}
@@ -101,7 +101,7 @@ public class BooleanUtils {
* @return {@code true} if the input is null or false
* @since 2.3
*/
- public static boolean isNotTrue(Boolean bool) {
+ public static boolean isNotTrue(final Boolean bool) {
return !isTrue(bool);
}
@@ -119,7 +119,7 @@ public class BooleanUtils {
* @return {@code true} only if the input is non-null and false
* @since 2.1
*/
- public static boolean isFalse(Boolean bool) {
+ public static boolean isFalse(final Boolean bool) {
return Boolean.FALSE.equals(bool);
}
@@ -137,7 +137,7 @@ public class BooleanUtils {
* @return {@code true} if the input is null or true
* @since 2.3
*/
- public static boolean isNotFalse(Boolean bool) {
+ public static boolean isNotFalse(final Boolean bool) {
return !isFalse(bool);
}
@@ -155,7 +155,7 @@ public class BooleanUtils {
* @param bool the boolean to convert
* @return {@code true} or {@code false}, {@code null} returns {@code false}
*/
- public static boolean toBoolean(Boolean bool) {
+ public static boolean toBoolean(final Boolean bool) {
return bool != null && bool.booleanValue();
}
@@ -172,7 +172,7 @@ public class BooleanUtils {
* @param valueIfNull the boolean value to return if {@code null}
* @return {@code true} or {@code false}
*/
- public static boolean toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull) {
+ public static boolean toBooleanDefaultIfNull(final Boolean bool, final boolean valueIfNull) {
if (bool == null) {
return valueIfNull;
}
@@ -195,7 +195,7 @@ public class BooleanUtils {
* @return {@code true} if non-zero, {@code false}
* if zero
*/
- public static boolean toBoolean(int value) {
+ public static boolean toBoolean(final int value) {
return value != 0;
}
@@ -213,7 +213,7 @@ public class BooleanUtils {
* @return Boolean.TRUE if non-zero, Boolean.FALSE if zero,
* {@code null} if {@code null}
*/
- public static Boolean toBooleanObject(int value) {
+ public static Boolean toBooleanObject(final int value) {
return value == 0 ? Boolean.FALSE : Boolean.TRUE;
}
@@ -235,7 +235,7 @@ public class BooleanUtils {
* @return Boolean.TRUE if non-zero, Boolean.FALSE if zero,
* {@code null} if {@code null} input
*/
- public static Boolean toBooleanObject(Integer value) {
+ public static Boolean toBooleanObject(final Integer value) {
if (value == null) {
return null;
}
@@ -258,7 +258,7 @@ public class BooleanUtils {
* @return {@code true} or {@code false}
* @throws IllegalArgumentException if no match
*/
- public static boolean toBoolean(int value, int trueValue, int falseValue) {
+ public static boolean toBoolean(final int value, final int trueValue, final int falseValue) {
if (value == trueValue) {
return true;
}
@@ -286,7 +286,7 @@ public class BooleanUtils {
* @return {@code true} or {@code false}
* @throws IllegalArgumentException if no match
*/
- public static boolean toBoolean(Integer value, Integer trueValue, Integer falseValue) {
+ public static boolean toBoolean(final Integer value, final Integer trueValue, final Integer falseValue) {
if (value == null) {
if (trueValue == null) {
return true;
@@ -321,7 +321,7 @@ public class BooleanUtils {
* @return Boolean.TRUE, Boolean.FALSE, or {@code null}
* @throws IllegalArgumentException if no match
*/
- public static Boolean toBooleanObject(int value, int trueValue, int falseValue, int nullValue) {
+ public static Boolean toBooleanObject(final int value, final int trueValue, final int falseValue, final int nullValue) {
if (value == trueValue) {
return Boolean.TRUE;
}
@@ -353,7 +353,7 @@ public class BooleanUtils {
* @return Boolean.TRUE, Boolean.FALSE, or {@code null}
* @throws IllegalArgumentException if no match
*/
- public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue) {
+ public static Boolean toBooleanObject(final Integer value, final Integer trueValue, final Integer falseValue, final Integer nullValue) {
if (value == null) {
if (trueValue == null) {
return Boolean.TRUE;
@@ -389,7 +389,7 @@ public class BooleanUtils {
* @param bool the boolean to convert
* @return one if {@code true}, zero if {@code false}
*/
- public static int toInteger(boolean bool) {
+ public static int toInteger(final boolean bool) {
return bool ? 1 : 0;
}
@@ -405,7 +405,7 @@ public class BooleanUtils {
* @param bool the boolean to convert
* @return one if {@code true}, zero if {@code false}
*/
- public static Integer toIntegerObject(boolean bool) {
+ public static Integer toIntegerObject(final boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
@@ -423,7 +423,7 @@ public class BooleanUtils {
* @param bool the Boolean to convert
* @return one if Boolean.TRUE, zero if Boolean.FALSE, {@code null} if {@code null}
*/
- public static Integer toIntegerObject(Boolean bool) {
+ public static Integer toIntegerObject(final Boolean bool) {
if (bool == null) {
return null;
}
@@ -443,7 +443,7 @@ public class BooleanUtils {
* @param falseValue the value to return if {@code false}
* @return the appropriate value
*/
- public static int toInteger(boolean bool, int trueValue, int falseValue) {
+ public static int toInteger(final boolean bool, final int trueValue, final int falseValue) {
return bool ? trueValue : falseValue;
}
@@ -462,7 +462,7 @@ public class BooleanUtils {
* @param nullValue the value to return if {@code null}
* @return the appropriate value
*/
- public static int toInteger(Boolean bool, int trueValue, int falseValue, int nullValue) {
+ public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) {
if (bool == null) {
return nullValue;
}
@@ -482,7 +482,7 @@ public class BooleanUtils {
* @param falseValue the value to return if {@code false}, may be {@code null}
* @return the appropriate value
*/
- public static Integer toIntegerObject(boolean bool, Integer trueValue, Integer falseValue) {
+ public static Integer toIntegerObject(final boolean bool, final Integer trueValue, final Integer falseValue) {
return bool ? trueValue : falseValue;
}
@@ -501,7 +501,7 @@ public class BooleanUtils {
* @param nullValue the value to return if {@code null}, may be {@code null}
* @return the appropriate value
*/
- public static Integer toIntegerObject(Boolean bool, Integer trueValue, Integer falseValue, Integer nullValue) {
+ public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) {
if (bool == null) {
return nullValue;
}
@@ -535,7 +535,7 @@ public class BooleanUtils {
* @param str the String to check
* @return the Boolean value of the string, {@code null} if no match or {@code null} input
*/
- public static Boolean toBooleanObject(String str) {
+ public static Boolean toBooleanObject(final String str) {
// Previously used equalsIgnoreCase, which was fast for interned 'true'.
// Non interned 'true' matched 15 times slower.
//
@@ -642,7 +642,7 @@ public class BooleanUtils {
* or if {@code null} input and {@code nullString} is {@code null}
* @throws IllegalArgumentException if the String doesn't match
*/
- public static Boolean toBooleanObject(String str, String trueString, String falseString, String nullString) {
+ public static Boolean toBooleanObject(final String str, final String trueString, final String falseString, final String nullString) {
if (str == null) {
if (trueString == null) {
return Boolean.TRUE;
@@ -691,7 +691,7 @@ public class BooleanUtils {
* @param str the String to check
* @return the boolean value of the string, {@code false} if no match or the String is null
*/
- public static boolean toBoolean(String str) {
+ public static boolean toBoolean(final String str) {
return toBooleanObject(str) == Boolean.TRUE;
}
@@ -709,7 +709,7 @@ public class BooleanUtils {
* @return the boolean value of the string
* @throws IllegalArgumentException if the String doesn't match
*/
- public static boolean toBoolean(String str, String trueString, String falseString) {
+ public static boolean toBoolean(final String str, final String trueString, final String falseString) {
if (str == trueString) {
return true;
} else if (str == falseString) {
@@ -740,7 +740,7 @@ public class BooleanUtils {
* @param bool the Boolean to check
* @return {@code 'true'}, {@code 'false'}, or {@code null}
*/
- public static String toStringTrueFalse(Boolean bool) {
+ public static String toStringTrueFalse(final Boolean bool) {
return toString(bool, "true", "false", null);
}
@@ -757,7 +757,7 @@ public class BooleanUtils {
* @param bool the Boolean to check
* @return {@code 'on'}, {@code 'off'}, or {@code null}
*/
- public static String toStringOnOff(Boolean bool) {
+ public static String toStringOnOff(final Boolean bool) {
return toString(bool, "on", "off", null);
}
@@ -774,7 +774,7 @@ public class BooleanUtils {
* @param bool the Boolean to check
* @return {@code 'yes'}, {@code 'no'}, or {@code null}
*/
- public static String toStringYesNo(Boolean bool) {
+ public static String toStringYesNo(final Boolean bool) {
return toString(bool, "yes", "no", null);
}
@@ -793,7 +793,7 @@ public class BooleanUtils {
* @param nullString the String to return if {@code null}, may be {@code null}
* @return one of the three input Strings
*/
- public static String toString(Boolean bool, String trueString, String falseString, String nullString) {
+ public static String toString(final Boolean bool, final String trueString, final String falseString, final String nullString) {
if (bool == null) {
return nullString;
}
@@ -814,7 +814,7 @@ public class BooleanUtils {
* @param bool the Boolean to check
* @return {@code 'true'}, {@code 'false'}, or {@code null}
*/
- public static String toStringTrueFalse(boolean bool) {
+ public static String toStringTrueFalse(final boolean bool) {
return toString(bool, "true", "false");
}
@@ -830,7 +830,7 @@ public class BooleanUtils {
* @param bool the Boolean to check
* @return {@code 'on'}, {@code 'off'}, or {@code null}
*/
- public static String toStringOnOff(boolean bool) {
+ public static String toStringOnOff(final boolean bool) {
return toString(bool, "on", "off");
}
@@ -846,7 +846,7 @@ public class BooleanUtils {
* @param bool the Boolean to check
* @return {@code 'yes'}, {@code 'no'}, or {@code null}
*/
- public static String toStringYesNo(boolean bool) {
+ public static String toStringYesNo(final boolean bool) {
return toString(bool, "yes", "no");
}
@@ -863,7 +863,7 @@ public class BooleanUtils {
* @param falseString the String to return if {@code false}, may be {@code null}
* @return one of the two input Strings
*/
- public static String toString(boolean bool, String trueString, String falseString) {
+ public static String toString(final boolean bool, final String trueString, final String falseString) {
return bool ? trueString : falseString;
}
@@ -886,7 +886,7 @@ public class BooleanUtils {
* @throws IllegalArgumentException if {@code array} is empty.
* @since 3.0.1
*/
- public static boolean and(boolean... array) {
+ public static boolean and(final boolean... array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
@@ -921,7 +921,7 @@ public class BooleanUtils {
* @throws IllegalArgumentException if {@code array} contains a {@code null}
* @since 3.0.1
*/
- public static Boolean and(Boolean... array) {
+ public static Boolean and(final Boolean... array) {
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
}
@@ -954,7 +954,7 @@ public class BooleanUtils {
* @throws IllegalArgumentException if {@code array} is empty.
* @since 3.0.1
*/
- public static boolean or(boolean... array) {
+ public static boolean or(final boolean... array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
@@ -990,7 +990,7 @@ public class BooleanUtils {
* @throws IllegalArgumentException if {@code array} contains a {@code null}
* @since 3.0.1
*/
- public static Boolean or(Boolean... array) {
+ public static Boolean or(final Boolean... array) {
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
}
@@ -1022,7 +1022,7 @@ public class BooleanUtils {
* @throws IllegalArgumentException if {@code array} is {@code null}
* @throws IllegalArgumentException if {@code array} is empty.
*/
- public static boolean xor(boolean... array) {
+ public static boolean xor(final boolean... array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
@@ -1064,7 +1064,7 @@ public class BooleanUtils {
* @throws IllegalArgumentException if {@code array} is empty.
* @throws IllegalArgumentException if {@code array} contains a {@code null}
*/
- public static Boolean xor(Boolean... array) {
+ public static Boolean xor(final Boolean... array) {
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharEncoding.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharEncoding.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharEncoding.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharEncoding.java Tue Jan 22 07:07:42 2013
@@ -91,7 +91,7 @@ public class CharEncoding {
* @param name the name of the requested charset; may be either a canonical name or an alias, null returns false
* @return {@code true} if the charset is available in the current Java virtual machine
*/
- public static boolean isSupported(String name) {
+ public static boolean isSupported(final String name) {
if (name == null) {
return false;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharRange.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharRange.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharRange.java Tue Jan 22 07:07:42 2013
@@ -64,7 +64,7 @@ final class CharRange implements Iterabl
* @param end last character, inclusive, in this range
* @param negated true to express everything except the range
*/
- private CharRange(char start, char end, boolean negated) {
+ private CharRange(char start, char end, final boolean negated) {
super();
if (start > end) {
char temp = start;
@@ -85,7 +85,7 @@ final class CharRange implements Iterabl
* @see CharRange#CharRange(char, char, boolean)
* @since 2.5
*/
- public static CharRange is(char ch) {
+ public static CharRange is(final char ch) {
return new CharRange(ch, ch, false);
}
@@ -97,7 +97,7 @@ final class CharRange implements Iterabl
* @see CharRange#CharRange(char, char, boolean)
* @since 2.5
*/
- public static CharRange isNot(char ch) {
+ public static CharRange isNot(final char ch) {
return new CharRange(ch, ch, true);
}
@@ -110,7 +110,7 @@ final class CharRange implements Iterabl
* @see CharRange#CharRange(char, char, boolean)
* @since 2.5
*/
- public static CharRange isIn(char start, char end) {
+ public static CharRange isIn(final char start, final char end) {
return new CharRange(start, end, false);
}
@@ -123,7 +123,7 @@ final class CharRange implements Iterabl
* @see CharRange#CharRange(char, char, boolean)
* @since 2.5
*/
- public static CharRange isNotIn(char start, char end) {
+ public static CharRange isNotIn(final char start, final char end) {
return new CharRange(start, end, true);
}
@@ -167,7 +167,7 @@ final class CharRange implements Iterabl
* @param ch the character to check
* @return {@code true} if this range contains the input character
*/
- public boolean contains(char ch) {
+ public boolean contains(final char ch) {
return (ch >= start && ch <= end) != negated;
}
@@ -179,7 +179,7 @@ final class CharRange implements Iterabl
* @return {@code true} if this range entirely contains the input range
* @throws IllegalArgumentException if {@code null} input
*/
- public boolean contains(CharRange range) {
+ public boolean contains(final CharRange range) {
if (range == null) {
throw new IllegalArgumentException("The Range must not be null");
}
@@ -205,7 +205,7 @@ final class CharRange implements Iterabl
* @return true if equal
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -278,7 +278,7 @@ final class CharRange implements Iterabl
*
* @param r The character range
*/
- private CharacterIterator(CharRange r) {
+ private CharacterIterator(final CharRange r) {
range = r;
hasNext = true;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java Tue Jan 22 07:07:42 2013
@@ -52,7 +52,7 @@ public class CharSequenceUtils {
* @throws IndexOutOfBoundsException if {@code start} is negative or if
* {@code start} is greater than {@code length()}
*/
- public static CharSequence subSequence(CharSequence cs, int start) {
+ public static CharSequence subSequence(final CharSequence cs, final int start) {
return cs == null ? null : cs.subSequence(start, cs.length());
}
@@ -66,7 +66,7 @@ public class CharSequenceUtils {
* @param start the start index, negative starts at the string start
* @return the index where the search char was found, -1 if not found
*/
- static int indexOf(CharSequence cs, int searchChar, int start) {
+ static int indexOf(final CharSequence cs, final int searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).indexOf(searchChar, start);
} else {
@@ -91,7 +91,7 @@ public class CharSequenceUtils {
* @param start the start index
* @return the index where the search sequence was found
*/
- static int indexOf(CharSequence cs, CharSequence searchChar, int start) {
+ static int indexOf(final CharSequence cs, final CharSequence searchChar, final int start) {
return cs.toString().indexOf(searchChar.toString(), start);
// if (cs instanceof String && searchChar instanceof String) {
// // TODO: Do we assume searchChar is usually relatively small;
@@ -113,7 +113,7 @@ public class CharSequenceUtils {
* @param start the start index, negative returns -1, beyond length starts at end
* @return the index where the search char was found, -1 if not found
*/
- static int lastIndexOf(CharSequence cs, int searchChar, int start) {
+ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).lastIndexOf(searchChar, start);
} else {
@@ -141,7 +141,7 @@ public class CharSequenceUtils {
* @param start the start index
* @return the index where the search sequence was found
*/
- static int lastIndexOf(CharSequence cs, CharSequence searchChar, int start) {
+ static int lastIndexOf(final CharSequence cs, final CharSequence searchChar, final int start) {
return cs.toString().lastIndexOf(searchChar.toString(), start);
// if (cs instanceof String && searchChar instanceof String) {
// // TODO: Do we assume searchChar is usually relatively small;
@@ -160,7 +160,7 @@ public class CharSequenceUtils {
* @param cs the {@code CharSequence} to be processed
* @return the resulting char array
*/
- static char[] toCharArray(CharSequence cs) {
+ static char[] toCharArray(final CharSequence cs) {
if (cs instanceof String) {
return ((String) cs).toCharArray();
} else {
@@ -184,8 +184,8 @@ public class CharSequenceUtils {
* @param length character length of the region
* @return whether the region matched
*/
- static boolean regionMatches(CharSequence cs, boolean ignoreCase, int thisStart,
- CharSequence substring, int start, int length) {
+ static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart,
+ final CharSequence substring, final int start, final int length) {
if (cs instanceof String && substring instanceof String) {
return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
} else {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java Tue Jan 22 07:07:42 2013
@@ -135,7 +135,7 @@ public class CharSet implements Serializ
* @return a CharSet instance
* @since 2.4
*/
- public static CharSet getInstance(String... setStrs) {
+ public static CharSet getInstance(final String... setStrs) {
if (setStrs == null) {
return null;
}
@@ -156,7 +156,7 @@ public class CharSet implements Serializ
* @param set Strings to merge into the initial set
* @throws NullPointerException if set is {@code null}
*/
- protected CharSet(String... set) {
+ protected CharSet(final String... set) {
super();
int sz = set.length;
for (int i = 0; i < sz; i++) {
@@ -170,7 +170,7 @@ public class CharSet implements Serializ
*
* @param str set definition string
*/
- protected void add(String str) {
+ protected void add(final String str) {
if (str == null) {
return;
}
@@ -220,7 +220,7 @@ public class CharSet implements Serializ
* @param ch the character to check for
* @return {@code true} if the set contains the characters
*/
- public boolean contains(char ch) {
+ public boolean contains(final char ch) {
for (CharRange range : set) {
if (range.contains(ch)) {
return true;
@@ -243,7 +243,7 @@ public class CharSet implements Serializ
* @since 2.0
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSetUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSetUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSetUtils.java Tue Jan 22 07:07:42 2013
@@ -61,7 +61,7 @@ public class CharSetUtils {
* @param set the character set to use for manipulation, may be null
* @return the modified String, {@code null} if null string input
*/
- public static String squeeze(String str, String... set) {
+ public static String squeeze(final String str, final String... set) {
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
return str;
}
@@ -103,7 +103,7 @@ public class CharSetUtils {
* @param set String[] set of characters to count, may be null
* @return the character count, zero if null string input
*/
- public static int count(String str, String... set) {
+ public static int count(final String str, final String... set) {
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
return 0;
}
@@ -138,7 +138,7 @@ public class CharSetUtils {
* @return the modified String, {@code null} if null string input
* @since 2.0
*/
- public static String keep(String str, String... set) {
+ public static String keep(final String str, final String... set) {
if (str == null) {
return null;
}
@@ -168,7 +168,7 @@ public class CharSetUtils {
* @param set String[] set of characters to delete, may be null
* @return the modified String, {@code null} if null string input
*/
- public static String delete(String str, String... set) {
+ public static String delete(final String str, final String... set) {
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
return str;
}
@@ -184,7 +184,7 @@ public class CharSetUtils {
* @param expect whether to evaluate on match, or non-match
* @return the modified String, not null
*/
- private static String modify(String str, String[] set, boolean expect) {
+ private static String modify(final String str, final String[] set, final boolean expect) {
CharSet chars = CharSet.getInstance(set);
StringBuilder buffer = new StringBuilder(str.length());
char[] chrs = str.toCharArray();
@@ -204,7 +204,7 @@ public class CharSetUtils {
* @param strings String[] whose elements are being checked for emptiness
* @return whether or not the String is empty
*/
- private static boolean deepEmpty(String[] strings) {
+ private static boolean deepEmpty(final String[] strings) {
if (strings != null) {
for (String s : strings) {
if (StringUtils.isNotEmpty(s)) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharUtils.java Tue Jan 22 07:07:42 2013
@@ -84,7 +84,7 @@ public class CharUtils {
* @return a Character of the specified character
*/
@Deprecated
- public static Character toCharacterObject(char ch) {
+ public static Character toCharacterObject(final char ch) {
return Character.valueOf(ch);
}
@@ -105,7 +105,7 @@ public class CharUtils {
* @param str the character to convert
* @return the Character value of the first letter of the String
*/
- public static Character toCharacterObject(String str) {
+ public static Character toCharacterObject(final String str) {
if (StringUtils.isEmpty(str)) {
return null;
}
@@ -126,7 +126,7 @@ public class CharUtils {
* @return the char value of the Character
* @throws IllegalArgumentException if the Character is null
*/
- public static char toChar(Character ch) {
+ public static char toChar(final Character ch) {
if (ch == null) {
throw new IllegalArgumentException("The Character must not be null");
}
@@ -146,7 +146,7 @@ public class CharUtils {
* @param defaultValue the value to use if the Character is null
* @return the char value of the Character or the default if null
*/
- public static char toChar(Character ch, char defaultValue) {
+ public static char toChar(final Character ch, final char defaultValue) {
if (ch == null) {
return defaultValue;
}
@@ -169,7 +169,7 @@ public class CharUtils {
* @return the char value of the first letter of the String
* @throws IllegalArgumentException if the String is empty
*/
- public static char toChar(String str) {
+ public static char toChar(final String str) {
if (StringUtils.isEmpty(str)) {
throw new IllegalArgumentException("The String must not be empty");
}
@@ -191,7 +191,7 @@ public class CharUtils {
* @param defaultValue the value to use if the Character is null
* @return the char value of the first letter of the String or the default if null
*/
- public static char toChar(String str, char defaultValue) {
+ public static char toChar(final String str, final char defaultValue) {
if (StringUtils.isEmpty(str)) {
return defaultValue;
}
@@ -214,7 +214,7 @@ public class CharUtils {
* @return the int value of the character
* @throws IllegalArgumentException if the character is not ASCII numeric
*/
- public static int toIntValue(char ch) {
+ public static int toIntValue(final char ch) {
if (isAsciiNumeric(ch) == false) {
throw new IllegalArgumentException("The character " + ch + " is not in the range '0' - '9'");
}
@@ -236,7 +236,7 @@ public class CharUtils {
* @param defaultValue the default value to use if the character is not numeric
* @return the int value of the character
*/
- public static int toIntValue(char ch, int defaultValue) {
+ public static int toIntValue(final char ch, final int defaultValue) {
if (isAsciiNumeric(ch) == false) {
return defaultValue;
}
@@ -259,7 +259,7 @@ public class CharUtils {
* @return the int value of the character
* @throws IllegalArgumentException if the Character is not ASCII numeric or is null
*/
- public static int toIntValue(Character ch) {
+ public static int toIntValue(final Character ch) {
if (ch == null) {
throw new IllegalArgumentException("The character must not be null");
}
@@ -282,7 +282,7 @@ public class CharUtils {
* @param defaultValue the default value to use if the character is not numeric
* @return the int value of the character
*/
- public static int toIntValue(Character ch, int defaultValue) {
+ public static int toIntValue(final Character ch, final int defaultValue) {
if (ch == null) {
return defaultValue;
}
@@ -304,7 +304,7 @@ public class CharUtils {
* @param ch the character to convert
* @return a String containing the one specified character
*/
- public static String toString(char ch) {
+ public static String toString(final char ch) {
if (ch < 128) {
return CHAR_STRING_ARRAY[ch];
}
@@ -328,7 +328,7 @@ public class CharUtils {
* @param ch the character to convert
* @return a String containing the one specified character
*/
- public static String toString(Character ch) {
+ public static String toString(final Character ch) {
if (ch == null) {
return null;
}
@@ -349,7 +349,7 @@ public class CharUtils {
* @param ch the character to convert
* @return the escaped Unicode string
*/
- public static String unicodeEscaped(char ch) {
+ public static String unicodeEscaped(final char ch) {
if (ch < 0x10) {
return "\\u000" + Integer.toHexString(ch);
} else if (ch < 0x100) {
@@ -376,7 +376,7 @@ public class CharUtils {
* @param ch the character to convert, may be null
* @return the escaped Unicode string, null if null input
*/
- public static String unicodeEscaped(Character ch) {
+ public static String unicodeEscaped(final Character ch) {
if (ch == null) {
return null;
}
@@ -399,7 +399,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if less than 128
*/
- public static boolean isAscii(char ch) {
+ public static boolean isAscii(final char ch) {
return ch < 128;
}
@@ -418,7 +418,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if between 32 and 126 inclusive
*/
- public static boolean isAsciiPrintable(char ch) {
+ public static boolean isAsciiPrintable(final char ch) {
return ch >= 32 && ch < 127;
}
@@ -437,7 +437,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if less than 32 or equals 127
*/
- public static boolean isAsciiControl(char ch) {
+ public static boolean isAsciiControl(final char ch) {
return ch < 32 || ch == 127;
}
@@ -456,7 +456,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if between 65 and 90 or 97 and 122 inclusive
*/
- public static boolean isAsciiAlpha(char ch) {
+ public static boolean isAsciiAlpha(final char ch) {
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
@@ -475,7 +475,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if between 65 and 90 inclusive
*/
- public static boolean isAsciiAlphaUpper(char ch) {
+ public static boolean isAsciiAlphaUpper(final char ch) {
return ch >= 'A' && ch <= 'Z';
}
@@ -494,7 +494,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if between 97 and 122 inclusive
*/
- public static boolean isAsciiAlphaLower(char ch) {
+ public static boolean isAsciiAlphaLower(final char ch) {
return ch >= 'a' && ch <= 'z';
}
@@ -513,7 +513,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if between 48 and 57 inclusive
*/
- public static boolean isAsciiNumeric(char ch) {
+ public static boolean isAsciiNumeric(final char ch) {
return ch >= '0' && ch <= '9';
}
@@ -532,7 +532,7 @@ public class CharUtils {
* @param ch the character to check
* @return true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive
*/
- public static boolean isAsciiAlphanumeric(char ch) {
+ public static boolean isAsciiAlphanumeric(final char ch) {
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9');
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java Tue Jan 22 07:07:42 2013
@@ -107,7 +107,7 @@ public class ClassUtils {
* @param primitive Canonical name of primitive type
* @param abbreviation Corresponding abbreviation of primitive type
*/
- private static void addAbbreviation(String primitive, String abbreviation) {
+ private static void addAbbreviation(final String primitive, final String abbreviation) {
abbreviationMap.put(primitive, abbreviation);
reverseAbbreviationMap.put(abbreviation, primitive);
}
@@ -147,7 +147,7 @@ public class ClassUtils {
* @param valueIfNull the value to return if null
* @return the class name of the object without the package name, or the null value
*/
- public static String getShortClassName(Object object, String valueIfNull) {
+ public static String getShortClassName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
@@ -164,7 +164,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(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@@ -224,7 +224,7 @@ public class ClassUtils {
* @since 3.0
* @see Class#getSimpleName()
*/
- public static String getSimpleName(Class<?> cls) {
+ public static String getSimpleName(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@@ -240,7 +240,7 @@ public class ClassUtils {
* @since 3.0
* @see Class#getSimpleName()
*/
- public static String getSimpleName(Object object, String valueIfNull) {
+ public static String getSimpleName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
@@ -256,7 +256,7 @@ public class ClassUtils {
* @param valueIfNull the value to return if null
* @return the package name of the object, or the null value
*/
- public static String getPackageName(Object object, String valueIfNull) {
+ public static String getPackageName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
@@ -269,7 +269,7 @@ public class ClassUtils {
* @param cls the class to get the package name for, may be {@code null}.
* @return the package name or an empty string
*/
- public static String getPackageName(Class<?> cls) {
+ public static String getPackageName(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@@ -315,7 +315,7 @@ public class ClassUtils {
* @return the {@code List} of superclasses in order going up from this one
* {@code null} if null input
*/
- public static List<Class<?>> getAllSuperclasses(Class<?> cls) {
+ public static List<Class<?>> getAllSuperclasses(final Class<?> cls) {
if (cls == null) {
return null;
}
@@ -341,7 +341,7 @@ public class ClassUtils {
* @return the {@code List} of interfaces in order,
* {@code null} if null input
*/
- public static List<Class<?>> getAllInterfaces(Class<?> cls) {
+ public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
if (cls == null) {
return null;
}
@@ -358,7 +358,7 @@ public class ClassUtils {
* @param cls the class to look up, may be {@code null}
* @param interfacesFound the {@code Set} of interfaces for the class
*/
- private static void getAllInterfaces(Class<?> cls, HashSet<Class<?>> interfacesFound) {
+ private static void getAllInterfaces(Class<?> cls, final HashSet<Class<?>> interfacesFound) {
while (cls != null) {
Class<?>[] interfaces = cls.getInterfaces();
@@ -386,7 +386,7 @@ public class ClassUtils {
* {@code null} if null input
* @throws ClassCastException if classNames contains a non String entry
*/
- public static List<Class<?>> convertClassNamesToClasses(List<String> classNames) {
+ public static List<Class<?>> convertClassNamesToClasses(final List<String> classNames) {
if (classNames == null) {
return null;
}
@@ -413,7 +413,7 @@ public class ClassUtils {
* {@code null} if null input
* @throws ClassCastException if {@code classes} contains a non-{@code Class} entry
*/
- public static List<String> convertClassesToClassNames(List<Class<?>> classes) {
+ public static List<String> convertClassesToClassNames(final List<Class<?>> classes) {
if (classes == null) {
return null;
}
@@ -466,7 +466,7 @@ public class ClassUtils {
* @param toClassArray the array of Classes to try to assign into, may be {@code null}
* @return {@code true} if assignment possible
*/
- public static boolean isAssignable(Class<?>[] classArray, Class<?>... toClassArray) {
+ public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) {
return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
}
@@ -502,7 +502,7 @@ public class ClassUtils {
* @param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
* @return {@code true} if assignment possible
*/
- public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, boolean autoboxing) {
+ public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, final boolean autoboxing) {
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) {
return false;
}
@@ -530,7 +530,7 @@ public class ClassUtils {
* {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
* @since 3.1
*/
- public static boolean isPrimitiveOrWrapper(Class<?> type) {
+ public static boolean isPrimitiveOrWrapper(final Class<?> type) {
if (type == null) {
return false;
}
@@ -547,7 +547,7 @@ public class ClassUtils {
* {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
* @since 3.1
*/
- public static boolean isPrimitiveWrapper(Class<?> type) {
+ public static boolean isPrimitiveWrapper(final Class<?> type) {
return wrapperPrimitiveMap.containsKey(type);
}
@@ -582,7 +582,7 @@ public class ClassUtils {
* @param toClass the Class to try to assign into, returns false if null
* @return {@code true} if assignment possible
*/
- public static boolean isAssignable(Class<?> cls, Class<?> toClass) {
+ public static boolean isAssignable(final Class<?> cls, final Class<?> toClass) {
return isAssignable(cls, toClass, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
}
@@ -613,7 +613,7 @@ public class ClassUtils {
* @param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
* @return {@code true} if assignment possible
*/
- public static boolean isAssignable(Class<?> cls, Class<?> toClass, boolean autoboxing) {
+ public static boolean isAssignable(Class<?> cls, final Class<?> toClass, final boolean autoboxing) {
if (toClass == null) {
return false;
}
@@ -698,7 +698,7 @@ public class ClassUtils {
* {@code cls} is not a primitive. {@code null} if null input.
* @since 2.1
*/
- public static Class<?> primitiveToWrapper(Class<?> cls) {
+ public static Class<?> primitiveToWrapper(final Class<?> cls) {
Class<?> convertedClass = cls;
if (cls != null && cls.isPrimitive()) {
convertedClass = primitiveWrapperMap.get(cls);
@@ -716,7 +716,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(final Class<?>... classes) {
if (classes == null) {
return null;
}
@@ -748,7 +748,7 @@ public class ClassUtils {
* @see #primitiveToWrapper(Class)
* @since 2.4
*/
- public static Class<?> wrapperToPrimitive(Class<?> cls) {
+ public static Class<?> wrapperToPrimitive(final Class<?> cls) {
return wrapperPrimitiveMap.get(cls);
}
@@ -766,7 +766,7 @@ public class ClassUtils {
* @see #wrapperToPrimitive(Class)
* @since 2.4
*/
- public static Class<?>[] wrappersToPrimitives(Class<?>... classes) {
+ public static Class<?>[] wrappersToPrimitives(final Class<?>... classes) {
if (classes == null) {
return null;
}
@@ -791,7 +791,7 @@ public class ClassUtils {
* @return {@code true} if the class is an inner or static nested class,
* false if not or {@code null}
*/
- public static boolean isInnerClass(Class<?> cls) {
+ public static boolean isInnerClass(final Class<?> cls) {
return cls != null && cls.getEnclosingClass() != null;
}
@@ -810,7 +810,7 @@ public class ClassUtils {
* @throws ClassNotFoundException if the class is not found
*/
public static Class<?> getClass(
- ClassLoader classLoader, String className, boolean initialize) throws ClassNotFoundException {
+ final ClassLoader classLoader, final String className, final boolean initialize) throws ClassNotFoundException {
try {
Class<?> clazz;
if (abbreviationMap.containsKey(className)) {
@@ -850,7 +850,7 @@ public class ClassUtils {
* @return the class represented by {@code className} using the {@code classLoader}
* @throws ClassNotFoundException if the class is not found
*/
- public static Class<?> getClass(ClassLoader classLoader, String className) throws ClassNotFoundException {
+ public static Class<?> getClass(final ClassLoader classLoader, final String className) throws ClassNotFoundException {
return getClass(classLoader, className, true);
}
@@ -865,7 +865,7 @@ public class ClassUtils {
* @return the class represented by {@code className} 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(final String className) throws ClassNotFoundException {
return getClass(className, true);
}
@@ -880,7 +880,7 @@ public class ClassUtils {
* @return the class represented by {@code className} 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(final String className, final boolean initialize) throws ClassNotFoundException {
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL;
return getClass(loader, className, initialize);
@@ -909,7 +909,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(final Class<?> cls, final String methodName, final Class<?>... parameterTypes)
throws SecurityException, NoSuchMethodException {
Method declaredMethod = cls.getMethod(methodName, parameterTypes);
@@ -978,7 +978,7 @@ public class ClassUtils {
* @return a {@code Class} array, {@code null} if null array input
* @since 2.4
*/
- public static Class<?>[] toClass(Object... array) {
+ public static Class<?>[] toClass(final Object... array) {
if (array == null) {
return null;
} else if (array.length == 0) {
@@ -1001,7 +1001,7 @@ public class ClassUtils {
* @return the canonical name of the object without the package name, or the null value
* @since 2.4
*/
- public static String getShortCanonicalName(Object object, String valueIfNull) {
+ public static String getShortCanonicalName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
@@ -1015,7 +1015,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(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@@ -1031,7 +1031,7 @@ public class ClassUtils {
* @return the canonical name of the class without the package name or an empty string
* @since 2.4
*/
- public static String getShortCanonicalName(String canonicalName) {
+ public static String getShortCanonicalName(final String canonicalName) {
return ClassUtils.getShortClassName(getCanonicalName(canonicalName));
}
@@ -1045,7 +1045,7 @@ public class ClassUtils {
* @return the package name of the object, or the null value
* @since 2.4
*/
- public static String getPackageCanonicalName(Object object, String valueIfNull) {
+ public static String getPackageCanonicalName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
@@ -1059,7 +1059,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(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
@@ -1076,7 +1076,7 @@ public class ClassUtils {
* @return the package name or an empty string
* @since 2.4
*/
- public static String getPackageCanonicalName(String canonicalName) {
+ public static String getPackageCanonicalName(final String canonicalName) {
return ClassUtils.getPackageName(getCanonicalName(canonicalName));
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java Tue Jan 22 07:07:42 2013
@@ -75,7 +75,7 @@ public class Conversion {
* @return an int equals to {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
*/
- public static int hexDigitToInt(char hexDigit) {
+ public static int hexDigitToInt(final char hexDigit) {
final int digit = Character.digit(hexDigit, 16);
if (digit < 0) {
throw new IllegalArgumentException("Cannot interpret '"
@@ -97,7 +97,7 @@ public class Conversion {
* @return an int equals to {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
*/
- public static int hexDigitMsb0ToInt(char hexDigit) {
+ public static int hexDigitMsb0ToInt(final char hexDigit) {
switch (hexDigit) {
case '0':
return 0x0;
@@ -157,7 +157,7 @@ public class Conversion {
* @return a boolean array with the binary representation of {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
*/
- public static boolean[] hexDigitToBinary(char hexDigit) {
+ public static boolean[] hexDigitToBinary(final char hexDigit) {
switch (hexDigit) {
case '0':
return new boolean[]{false, false, false, false};
@@ -217,7 +217,7 @@ public class Conversion {
* @return a boolean array with the binary representation of {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
*/
- public static boolean[] hexDigitMsb0ToBinary(char hexDigit) {
+ public static boolean[] hexDigitMsb0ToBinary(final char hexDigit) {
switch (hexDigit) {
case '0':
return new boolean[]{false, false, false, false};
@@ -278,7 +278,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code src} is empty
* @throws NullPointerException if {@code src} is {@code null}
*/
- public static char binaryToHexDigit(boolean[] src) {
+ public static char binaryToHexDigit(final boolean[] src) {
return binaryToHexDigit(src, 0);
}
@@ -297,7 +297,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code src} is empty
* @throws NullPointerException if {@code src} is {@code null}
*/
- public static char binaryToHexDigit(boolean[] src, int srcPos) {
+ public static char binaryToHexDigit(final boolean[] src, final int srcPos) {
if (src.length == 0) {
throw new IllegalArgumentException("Cannot convert an empty array.");
}
@@ -379,7 +379,7 @@ public class Conversion {
* {@code src.length > 8}
* @throws NullPointerException if {@code src} is {@code null}
*/
- public static char binaryToHexDigitMsb0_4bits(boolean[] src) {
+ public static char binaryToHexDigitMsb0_4bits(final boolean[] src) {
return binaryToHexDigitMsb0_4bits(src, 0);
}
@@ -400,7 +400,7 @@ public class Conversion {
* {@code src.length - srcPos < 4}
* @throws NullPointerException if {@code src} is {@code null}
*/
- public static char binaryToHexDigitMsb0_4bits(boolean[] src, int srcPos) {
+ public static char binaryToHexDigitMsb0_4bits(final boolean[] src, final int srcPos) {
if (src.length > 8) {
throw new IllegalArgumentException("src.length>8: src.length=" + src.length);
}
@@ -488,7 +488,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code src} is empty
* @throws NullPointerException if {@code src} is {@code null}
*/
- public static char binaryBeMsb0ToHexDigit(boolean[] src) {
+ public static char binaryBeMsb0ToHexDigit(final boolean[] src) {
return binaryBeMsb0ToHexDigit(src, 0);
}
@@ -599,7 +599,7 @@ public class Conversion {
* @return a hexadecimal digit representing the 4 lsb of {@code nibble}
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
*/
- public static char intToHexDigit(int nibble) {
+ public static char intToHexDigit(final int nibble) {
char c = Character.forDigit(nibble, 16);
if (c == Character.MIN_VALUE) {
throw new IllegalArgumentException("nibble value not between 0 and 15: " + nibble);
@@ -625,7 +625,7 @@ public class Conversion {
* @return a hexadecimal digit representing the 4 lsb of {@code nibble}
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
*/
- public static char intToHexDigitMsb0(int nibble) {
+ public static char intToHexDigitMsb0(final int nibble) {
switch (nibble) {
case 0x0:
return '0';
@@ -681,7 +681,7 @@ public class Conversion {
* @throws NullPointerException if {@code src} is {@code null}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nInts > src.length}
*/
- public static long intArrayToLong(int[] src, int srcPos, long dstInit, int dstPos, int nInts) {
+ public static long intArrayToLong(final int[] src, final int srcPos, final long dstInit, final int dstPos, final int nInts) {
if ((src.length == 0 && srcPos == 0) || 0 == nInts) {
return dstInit;
}
@@ -717,8 +717,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}
*/
- public static long shortArrayToLong(short[] src, int srcPos, long dstInit, int dstPos,
- int nShorts) {
+ public static long shortArrayToLong(final short[] src, final int srcPos, final long dstInit, final int dstPos,
+ final int nShorts) {
if ((src.length == 0 && srcPos == 0) || 0 == nShorts) {
return dstInit;
}
@@ -754,8 +754,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 32}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}
*/
- public static int shortArrayToInt(short[] src, int srcPos, int dstInit, int dstPos,
- int nShorts) {
+ public static int shortArrayToInt(final short[] src, final int srcPos, final int dstInit, final int dstPos,
+ final int nShorts) {
if ((src.length == 0 && srcPos == 0) || 0 == nShorts) {
return dstInit;
}
@@ -791,8 +791,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
*/
- public static long byteArrayToLong(byte[] src, int srcPos, long dstInit, int dstPos,
- int nBytes) {
+ public static long byteArrayToLong(final byte[] src, final int srcPos, final long dstInit, final int dstPos,
+ final int nBytes) {
if ((src.length == 0 && srcPos == 0) || 0 == nBytes) {
return dstInit;
}
@@ -828,7 +828,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 32}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
*/
- public static int byteArrayToInt(byte[] src, int srcPos, int dstInit, int dstPos, int nBytes) {
+ public static int byteArrayToInt(final byte[] src, final int srcPos, final int dstInit, final int dstPos, final int nBytes) {
if ((src.length == 0 && srcPos == 0) || 0 == nBytes) {
return dstInit;
}
@@ -864,8 +864,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 16}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
*/
- public static short byteArrayToShort(byte[] src, int srcPos, short dstInit, int dstPos,
- int nBytes) {
+ public static short byteArrayToShort(final byte[] src, final int srcPos, final short dstInit, final int dstPos,
+ final int nBytes) {
if ((src.length == 0 && srcPos == 0) || 0 == nBytes) {
return dstInit;
}
@@ -899,7 +899,7 @@ public class Conversion {
* @return a long containing the selected bits
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 64}
*/
- public static long hexToLong(String src, int srcPos, long dstInit, int dstPos, int nHex) {
+ public static long hexToLong(final String src, final int srcPos, final long dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
return dstInit;
}
@@ -933,7 +933,7 @@ public class Conversion {
* @return a int containing the selected bits
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 32}
*/
- public static int hexToInt(String src, int srcPos, int dstInit, int dstPos, int nHex) {
+ public static int hexToInt(final String src, final int srcPos, final int dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
return dstInit;
}
@@ -967,7 +967,7 @@ public class Conversion {
* @return a short containing the selected bits
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 16}
*/
- public static short hexToShort(String src, int srcPos, short dstInit, int dstPos, int nHex) {
+ public static short hexToShort(final String src, final int srcPos, final short dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
return dstInit;
}
@@ -1001,7 +1001,7 @@ public class Conversion {
* @return a byte containing the selected bits
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 8}
*/
- public static byte hexToByte(String src, int srcPos, byte dstInit, int dstPos, int nHex) {
+ public static byte hexToByte(final String src, final int srcPos, final byte dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
return dstInit;
}
@@ -1037,8 +1037,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
*/
- public static long binaryToLong(boolean[] src, int srcPos, long dstInit, int dstPos,
- int nBools) {
+ public static long binaryToLong(final boolean[] src, final int srcPos, final long dstInit, final int dstPos,
+ final int nBools) {
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
return dstInit;
}
@@ -1074,7 +1074,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 32}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
*/
- public static int binaryToInt(boolean[] src, int srcPos, int dstInit, int dstPos, int nBools) {
+ public static int binaryToInt(final boolean[] src, final int srcPos, final int dstInit, final int dstPos, final int nBools) {
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
return dstInit;
}
@@ -1110,8 +1110,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 16}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
*/
- public static short binaryToShort(boolean[] src, int srcPos, short dstInit, int dstPos,
- int nBools) {
+ public static short binaryToShort(final boolean[] src, final int srcPos, final short dstInit, final int dstPos,
+ final int nBools) {
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
return dstInit;
}
@@ -1147,8 +1147,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 8}
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
*/
- public static byte binaryToByte(boolean[] src, int srcPos, byte dstInit, int dstPos,
- int nBools) {
+ public static byte binaryToByte(final boolean[] src, final int srcPos, final byte dstInit, final int dstPos,
+ final int nBools) {
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
return dstInit;
}
@@ -1183,7 +1183,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nInts-1)*32+srcPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nInts > dst.length}
*/
- public static int[] longToIntArray(long src, int srcPos, int[] dst, int dstPos, int nInts) {
+ public static int[] longToIntArray(final long src, final int srcPos, final int[] dst, final int dstPos, final int nInts) {
if (0 == nInts) {
return dst;
}
@@ -1216,8 +1216,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}
*/
- public static short[] longToShortArray(long src, int srcPos, short[] dst, int dstPos,
- int nShorts) {
+ public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos,
+ final int nShorts) {
if (0 == nShorts) {
return dst;
}
@@ -1250,8 +1250,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 32}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}
*/
- public static short[] intToShortArray(int src, int srcPos, short[] dst, int dstPos,
- int nShorts) {
+ public static short[] intToShortArray(final int src, final int srcPos, final short[] dst, final int dstPos,
+ final int nShorts) {
if (0 == nShorts) {
return dst;
}
@@ -1284,8 +1284,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
*/
- public static byte[] longToByteArray(long src, int srcPos, byte[] dst, int dstPos,
- int nBytes) {
+ public static byte[] longToByteArray(final long src, final int srcPos, final byte[] dst, final int dstPos,
+ final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -1318,7 +1318,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 32}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
*/
- public static byte[] intToByteArray(int src, int srcPos, byte[] dst, int dstPos, int nBytes) {
+ public static byte[] intToByteArray(final int src, final int srcPos, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -1351,8 +1351,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 16}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
*/
- public static byte[] shortToByteArray(short src, int srcPos, byte[] dst, int dstPos,
- int nBytes) {
+ public static byte[] shortToByteArray(final short src, final int srcPos, final byte[] dst, final int dstPos,
+ final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -1384,7 +1384,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 64}
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
*/
- public static String longToHex(long src, int srcPos, String dstInit, int dstPos, int nHexs) {
+ public static String longToHex(final long src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1424,7 +1424,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 32}
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
*/
- public static String intToHex(int src, int srcPos, String dstInit, int dstPos, int nHexs) {
+ public static String intToHex(final int src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1464,7 +1464,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 16}
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
*/
- public static String shortToHex(short src, int srcPos, String dstInit, int dstPos, int nHexs) {
+ public static String shortToHex(final short src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1504,7 +1504,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 8}
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
*/
- public static String byteToHex(byte src, int srcPos, String dstInit, int dstPos, int nHexs) {
+ public static String byteToHex(final byte src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
if (0 == nHexs) {
return dstInit;
}
@@ -1545,8 +1545,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 64}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
*/
- public static boolean[] longToBinary(long src, int srcPos, boolean[] dst, int dstPos,
- int nBools) {
+ public static boolean[] longToBinary(final long src, final int srcPos, final boolean[] dst, final int dstPos,
+ final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -1579,8 +1579,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 32}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
*/
- public static boolean[] intToBinary(int src, int srcPos, boolean[] dst, int dstPos,
- int nBools) {
+ public static boolean[] intToBinary(final int src, final int srcPos, final boolean[] dst, final int dstPos,
+ final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -1613,8 +1613,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 16}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
*/
- public static boolean[] shortToBinary(short src, int srcPos, boolean[] dst, int dstPos,
- int nBools) {
+ public static boolean[] shortToBinary(final short src, final int srcPos, final boolean[] dst, final int dstPos,
+ final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -1648,8 +1648,8 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 8}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
*/
- public static boolean[] byteToBinary(byte src, int srcPos, boolean[] dst, int dstPos,
- int nBools) {
+ public static boolean[] byteToBinary(final byte src, final int srcPos, final boolean[] dst, final int dstPos,
+ final int nBools) {
if (0 == nBools) {
return dst;
}
@@ -1680,7 +1680,7 @@ public class Conversion {
* @throws IllegalArgumentException if {@code nBytes > 16}
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
*/
- public static byte[] uuidToByteArray(UUID src, byte[] dst, int dstPos, int nBytes) {
+ public static byte[] uuidToByteArray(final UUID src, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
@@ -1707,7 +1707,7 @@ public class Conversion {
* @throws IllegalArgumentException if array does not contain at least 16 bytes beginning
* with {@code srcPos}
*/
- public static UUID byteArrayToUuid(byte[] src, int srcPos) {
+ public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
if (src.length - srcPos < 16) {
throw new IllegalArgumentException("Need at least 16 bytes for UUID");
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/EnumUtils.java Tue Jan 22 07:07:42 2013
@@ -55,7 +55,7 @@ public class EnumUtils {
* @param enumClass the class of the enum to query, not null
* @return the modifiable map of enum names to enums, never null
*/
- public static <E extends Enum<E>> Map<String, E> getEnumMap(Class<E> enumClass) {
+ public static <E extends Enum<E>> Map<String, E> getEnumMap(final Class<E> enumClass) {
Map<String, E> map = new LinkedHashMap<String, E>();
for (E e: enumClass.getEnumConstants()) {
map.put(e.name(), e);
@@ -72,7 +72,7 @@ public class EnumUtils {
* @param enumClass the class of the enum to query, not null
* @return the modifiable list of enums, never null
*/
- public static <E extends Enum<E>> List<E> getEnumList(Class<E> enumClass) {
+ public static <E extends Enum<E>> List<E> getEnumList(final Class<E> enumClass) {
return new ArrayList<E>(Arrays.asList(enumClass.getEnumConstants()));
}
@@ -87,7 +87,7 @@ public class EnumUtils {
* @param enumName the enum name, null returns false
* @return true if the enum name is valid, otherwise false
*/
- public static <E extends Enum<E>> boolean isValidEnum(Class<E> enumClass, String enumName) {
+ public static <E extends Enum<E>> boolean isValidEnum(final Class<E> enumClass, final String enumName) {
if (enumName == null) {
return false;
}
@@ -110,7 +110,7 @@ public class EnumUtils {
* @param enumName the enum name, null returns null
* @return the enum, null if not found
*/
- public static <E extends Enum<E>> E getEnum(Class<E> enumClass, String enumName) {
+ public static <E extends Enum<E>> E getEnum(final Class<E> enumClass, final String enumName) {
if (enumName == null) {
return null;
}
@@ -139,7 +139,7 @@ public class EnumUtils {
* @since 3.0.1
* @see #generateBitVectors(Class, Iterable)
*/
- public static <E extends Enum<E>> long generateBitVector(Class<E> enumClass, Iterable<E> values) {
+ public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final Iterable<E> values) {
checkBitVectorable(enumClass);
Validate.notNull(values);
long total = 0;
@@ -166,7 +166,7 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}
* @since 3.2
*/
- public static <E extends Enum<E>> long[] generateBitVectors(Class<E> enumClass, Iterable<E> values) {
+ public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumClass, final Iterable<E> values) {
asEnum(enumClass);
Validate.notNull(values);
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
@@ -199,7 +199,7 @@ public class EnumUtils {
* @since 3.0.1
* @see #generateBitVectors(Class, Iterable)
*/
- public static <E extends Enum<E>> long generateBitVector(Class<E> enumClass, E... values) {
+ public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final E... values) {
Validate.noNullElements(values);
return generateBitVector(enumClass, Arrays.<E> asList(values));
}
@@ -220,7 +220,7 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}
* @since 3.2
*/
- public static <E extends Enum<E>> long[] generateBitVectors(Class<E> enumClass, E... values) {
+ public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumClass, final E... values) {
asEnum(enumClass);
Validate.noNullElements(values);
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
@@ -246,7 +246,7 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
* @since 3.0.1
*/
- public static <E extends Enum<E>> EnumSet<E> processBitVector(Class<E> enumClass, long value) {
+ public static <E extends Enum<E>> EnumSet<E> processBitVector(final Class<E> enumClass, final long value) {
checkBitVectorable(enumClass).getEnumConstants();
return processBitVectors(enumClass, value);
}
@@ -264,7 +264,7 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class
* @since 3.2
*/
- public static <E extends Enum<E>> EnumSet<E> processBitVectors(Class<E> enumClass, long... values) {
+ public static <E extends Enum<E>> EnumSet<E> processBitVectors(final Class<E> enumClass, long... values) {
final EnumSet<E> results = EnumSet.noneOf(asEnum(enumClass));
values = ArrayUtils.clone(Validate.notNull(values));
ArrayUtils.reverse(values);
@@ -286,7 +286,7 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
* @since 3.0.1
*/
- private static <E extends Enum<E>> Class<E> checkBitVectorable(Class<E> enumClass) {
+ private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> enumClass) {
final E[] constants = asEnum(enumClass).getEnumConstants();
Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS, constants.length,
enumClass.getSimpleName(), Long.SIZE);
@@ -303,7 +303,7 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class
* @since 3.2
*/
- private static <E extends Enum<E>> Class<E> asEnum(Class<E> enumClass) {
+ private static <E extends Enum<E>> Class<E> asEnum(final Class<E> enumClass) {
Validate.notNull(enumClass, ENUM_CLASS_MUST_BE_DEFINED);
Validate.isTrue(enumClass.isEnum(), S_DOES_NOT_SEEM_TO_BE_AN_ENUM_TYPE, enumClass);
return enumClass;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/JavaVersion.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/JavaVersion.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/JavaVersion.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/JavaVersion.java Tue Jan 22 07:07:42 2013
@@ -101,7 +101,7 @@ public enum JavaVersion {
* @param requiredVersion the version to check against, not null
* @return true if this version is equal to or greater than the specified version
*/
- public boolean atLeast(JavaVersion requiredVersion) {
+ public boolean atLeast(final JavaVersion requiredVersion) {
return this.value >= requiredVersion.value;
}