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 [11/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/apa...
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java Tue Jan 22 07:07:42 2013
@@ -63,7 +63,7 @@ public class WordUtils {
* @param wrapLength the column to wrap the words at, less than 1 is treated as 1
* @return a line with newlines inserted, <code>null</code> if null input
*/
- public static String wrap(String str, int wrapLength) {
+ public static String wrap(final String str, final int wrapLength) {
return wrap(str, wrapLength, null, false);
}
@@ -85,7 +85,7 @@ public class WordUtils {
* @param wrapLongWords true if long words (such as URLs) should be wrapped
* @return a line with newlines inserted, <code>null</code> if null input
*/
- public static String wrap(String str, int wrapLength, String newLineStr, boolean wrapLongWords) {
+ public static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords) {
if (str == null) {
return null;
}
@@ -164,7 +164,7 @@ public class WordUtils {
* @see #uncapitalize(String)
* @see #capitalizeFully(String)
*/
- public static String capitalize(String str) {
+ public static String capitalize(final String str) {
return capitalize(str, null);
}
@@ -197,7 +197,7 @@ public class WordUtils {
* @see #capitalizeFully(String)
* @since 2.1
*/
- public static String capitalize(String str, char... delimiters) {
+ public static String capitalize(final String str, final char... delimiters) {
int delimLen = delimiters == null ? -1 : delimiters.length;
if (StringUtils.isEmpty(str) || delimLen == 0) {
return str;
@@ -236,7 +236,7 @@ public class WordUtils {
* @param str the String to capitalize, may be null
* @return capitalized String, <code>null</code> if null String input
*/
- public static String capitalizeFully(String str) {
+ public static String capitalizeFully(final String str) {
return capitalizeFully(str, null);
}
@@ -266,7 +266,7 @@ public class WordUtils {
* @return capitalized String, <code>null</code> if null String input
* @since 2.1
*/
- public static String capitalizeFully(String str, char... delimiters) {
+ public static String capitalizeFully(String str, final char... delimiters) {
int delimLen = delimiters == null ? -1 : delimiters.length;
if (StringUtils.isEmpty(str) || delimLen == 0) {
return str;
@@ -293,7 +293,7 @@ public class WordUtils {
* @return uncapitalized String, <code>null</code> if null String input
* @see #capitalize(String)
*/
- public static String uncapitalize(String str) {
+ public static String uncapitalize(final String str) {
return uncapitalize(str, null);
}
@@ -322,7 +322,7 @@ public class WordUtils {
* @see #capitalize(String)
* @since 2.1
*/
- public static String uncapitalize(String str, char... delimiters) {
+ public static String uncapitalize(final String str, final char... delimiters) {
int delimLen = delimiters == null ? -1 : delimiters.length;
if (StringUtils.isEmpty(str) || delimLen == 0) {
return str;
@@ -364,7 +364,7 @@ public class WordUtils {
* @param str the String to swap case, may be null
* @return the changed String, <code>null</code> if null String input
*/
- public static String swapCase(String str) {
+ public static String swapCase(final String str) {
if (StringUtils.isEmpty(str)) {
return str;
}
@@ -417,7 +417,7 @@ public class WordUtils {
* @see #initials(String,char[])
* @since 2.2
*/
- public static String initials(String str) {
+ public static String initials(final String str) {
return initials(str, null);
}
@@ -448,7 +448,7 @@ public class WordUtils {
* @see #initials(String)
* @since 2.2
*/
- public static String initials(String str, char... delimiters) {
+ public static String initials(final String str, final char... delimiters) {
if (StringUtils.isEmpty(str)) {
return str;
}
@@ -482,7 +482,7 @@ public class WordUtils {
* @param delimiters the delimiters
* @return true if it is a delimiter
*/
- private static boolean isDelimiter(char ch, char[] delimiters) {
+ private static boolean isDelimiter(final char ch, final char[] delimiters) {
if (delimiters == null) {
return Character.isWhitespace(ch);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java Tue Jan 22 07:07:42 2013
@@ -37,7 +37,7 @@ public class AggregateTranslator extends
*
* @param translators CharSequenceTranslator array to aggregate
*/
- public AggregateTranslator(CharSequenceTranslator... translators) {
+ public AggregateTranslator(final CharSequenceTranslator... translators) {
this.translators = ArrayUtils.clone(translators);
}
@@ -47,7 +47,7 @@ public class AggregateTranslator extends
* {@inheritDoc}
*/
@Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
+ public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
for (CharSequenceTranslator translator : translators) {
int consumed = translator.translate(input, index, out);
if(consumed != 0) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java Tue Jan 22 07:07:42 2013
@@ -50,7 +50,7 @@ public abstract class CharSequenceTransl
* @param input CharSequence to be translated
* @return String output of translation
*/
- public final String translate(CharSequence input) {
+ public final String translate(final CharSequence input) {
if (input == null) {
return null;
}
@@ -72,7 +72,7 @@ public abstract class CharSequenceTransl
* @param out Writer to translate the text to
* @throws IOException if and only if the Writer produces an IOException
*/
- public final void translate(CharSequence input, Writer out) throws IOException {
+ public final void translate(final CharSequence input, final Writer out) throws IOException {
if (out == null) {
throw new IllegalArgumentException("The Writer must not be null");
}
@@ -104,7 +104,7 @@ public abstract class CharSequenceTransl
* @param translators CharSequenceTranslator array of translators to merge with this one
* @return CharSequenceTranslator merging this translator with the others
*/
- public final CharSequenceTranslator with(CharSequenceTranslator... translators) {
+ public final CharSequenceTranslator with(final CharSequenceTranslator... translators) {
CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1];
newArray[0] = this;
System.arraycopy(translators, 0, newArray, 1, translators.length);
@@ -118,7 +118,7 @@ public abstract class CharSequenceTransl
* @param codepoint The codepoint to convert.
* @return An upper case hexadecimal <code>String</code>
*/
- public static String hex(int codepoint) {
+ public static String hex(final int codepoint) {
return Integer.toHexString(codepoint).toUpperCase(Locale.ENGLISH);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java Tue Jan 22 07:07:42 2013
@@ -33,7 +33,7 @@ public abstract class CodePointTranslato
* {@inheritDoc}
*/
@Override
- public final int translate(CharSequence input, int index, Writer out) throws IOException {
+ public final int translate(final CharSequence input, final int index, final Writer out) throws IOException {
int codepoint = Character.codePointAt(input, index);
boolean consumed = translate(codepoint, out);
if (consumed) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java Tue Jan 22 07:07:42 2013
@@ -413,7 +413,7 @@ public class EntityArrays {
* @param array String[][] to be inverted
* @return String[][] inverted array
*/
- public static String[][] invert(String[][] array) {
+ public static String[][] invert(final String[][] array) {
String[][] newarray = new String[array.length][2];
for(int i = 0; i<array.length; i++) {
newarray[i][0] = array[i][1];
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java Tue Jan 22 07:07:42 2013
@@ -17,7 +17,7 @@ public class JavaUnicodeEscaper extends
* above which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static JavaUnicodeEscaper above(int codepoint) {
+ public static JavaUnicodeEscaper above(final int codepoint) {
return outsideOf(0, codepoint);
}
@@ -30,7 +30,7 @@ public class JavaUnicodeEscaper extends
* below which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static JavaUnicodeEscaper below(int codepoint) {
+ public static JavaUnicodeEscaper below(final int codepoint) {
return outsideOf(codepoint, Integer.MAX_VALUE);
}
@@ -45,7 +45,7 @@ public class JavaUnicodeEscaper extends
* below which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static JavaUnicodeEscaper between(int codepointLow, int codepointHigh) {
+ public static JavaUnicodeEscaper between(final int codepointLow, final int codepointHigh) {
return new JavaUnicodeEscaper(codepointLow, codepointHigh, true);
}
@@ -60,7 +60,7 @@ public class JavaUnicodeEscaper extends
* above which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static JavaUnicodeEscaper outsideOf(int codepointLow, int codepointHigh) {
+ public static JavaUnicodeEscaper outsideOf(final int codepointLow, final int codepointHigh) {
return new JavaUnicodeEscaper(codepointLow, codepointHigh, false);
}
@@ -78,7 +78,7 @@ public class JavaUnicodeEscaper extends
* @param between
* whether to escape between the boundaries or outside them
*/
- public JavaUnicodeEscaper(int below, int above, boolean between) {
+ public JavaUnicodeEscaper(final int below, final int above, final boolean between) {
super(below, above, between);
}
@@ -89,7 +89,7 @@ public class JavaUnicodeEscaper extends
* a Unicode code point
*/
@Override
- protected String toUtf16Escape(int codepoint) {
+ protected String toUtf16Escape(final int codepoint) {
char[] surrogatePair = Character.toChars(codepoint);
return "\\u" + hex(surrogatePair[0]) + "\\u" + hex(surrogatePair[1]);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java Tue Jan 22 07:07:42 2013
@@ -37,7 +37,7 @@ public class LookupTranslator extends Ch
*
* @param lookup CharSequence[][] table of size [*][2]
*/
- public LookupTranslator(CharSequence[]... lookup) {
+ public LookupTranslator(final CharSequence[]... lookup) {
lookupMap = new HashMap<CharSequence, CharSequence>();
int _shortest = Integer.MAX_VALUE;
int _longest = 0;
@@ -61,7 +61,7 @@ public class LookupTranslator extends Ch
* {@inheritDoc}
*/
@Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
+ public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
int max = longest;
if (index + longest > input.length()) {
max = input.length() - index;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java Tue Jan 22 07:07:42 2013
@@ -41,7 +41,7 @@ public class NumericEntityEscaper extend
* @param above int value representing the highest codepoint boundary
* @param between whether to escape between the boundaries or outside them
*/
- private NumericEntityEscaper(int below, int above, boolean between) {
+ private NumericEntityEscaper(final int below, final int above, final boolean between) {
this.below = below;
this.above = above;
this.between = between;
@@ -60,7 +60,7 @@ public class NumericEntityEscaper extend
* @param codepoint below which to escape
* @return the newly created {@code NumericEntityEscaper} instance
*/
- public static NumericEntityEscaper below(int codepoint) {
+ public static NumericEntityEscaper below(final int codepoint) {
return outsideOf(codepoint, Integer.MAX_VALUE);
}
@@ -70,7 +70,7 @@ public class NumericEntityEscaper extend
* @param codepoint above which to escape
* @return the newly created {@code NumericEntityEscaper} instance
*/
- public static NumericEntityEscaper above(int codepoint) {
+ public static NumericEntityEscaper above(final int codepoint) {
return outsideOf(0, codepoint);
}
@@ -81,7 +81,7 @@ public class NumericEntityEscaper extend
* @param codepointHigh below which to escape
* @return the newly created {@code NumericEntityEscaper} instance
*/
- public static NumericEntityEscaper between(int codepointLow, int codepointHigh) {
+ public static NumericEntityEscaper between(final int codepointLow, final int codepointHigh) {
return new NumericEntityEscaper(codepointLow, codepointHigh, true);
}
@@ -92,7 +92,7 @@ public class NumericEntityEscaper extend
* @param codepointHigh above which to escape
* @return the newly created {@code NumericEntityEscaper} instance
*/
- public static NumericEntityEscaper outsideOf(int codepointLow, int codepointHigh) {
+ public static NumericEntityEscaper outsideOf(final int codepointLow, final int codepointHigh) {
return new NumericEntityEscaper(codepointLow, codepointHigh, false);
}
@@ -100,7 +100,7 @@ public class NumericEntityEscaper extend
* {@inheritDoc}
*/
@Override
- public boolean translate(int codepoint, Writer out) throws IOException {
+ public boolean translate(final int codepoint, final Writer out) throws IOException {
if(between) {
if (codepoint < below || codepoint > above) {
return false;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java Tue Jan 22 07:07:42 2013
@@ -53,7 +53,7 @@ public class NumericEntityUnescaper exte
*
* @param options to apply to this unescaper
*/
- public NumericEntityUnescaper(OPTION... options) {
+ public NumericEntityUnescaper(final OPTION... options) {
if(options.length > 0) {
this.options = EnumSet.copyOf(Arrays.asList(options));
} else {
@@ -67,7 +67,7 @@ public class NumericEntityUnescaper exte
* @param option to check state of
* @return whether the option is set
*/
- public boolean isSet(OPTION option) {
+ public boolean isSet(final OPTION option) {
return options == null ? false : options.contains(option);
}
@@ -75,7 +75,7 @@ public class NumericEntityUnescaper exte
* {@inheritDoc}
*/
@Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
+ public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
int seqEnd = input.length();
// Uses -2 to ensure there is something after the &#
if(input.charAt(index) == '&' && index < seqEnd - 2 && input.charAt(index + 1) == '#') {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java Tue Jan 22 07:07:42 2013
@@ -39,7 +39,7 @@ public class OctalUnescaper extends Char
* {@inheritDoc}
*/
@Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
+ public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
if(input.charAt(index) == '\\' && index < (input.length() - 1) && Character.isDigit(input.charAt(index + 1)) ) {
int start = index + 1;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java Tue Jan 22 07:07:42 2013
@@ -48,7 +48,7 @@ public class UnicodeEscaper extends Code
* @param above int value representing the highest codepoint boundary
* @param between whether to escape between the boundaries or outside them
*/
- protected UnicodeEscaper(int below, int above, boolean between) {
+ protected UnicodeEscaper(final int below, final int above, final boolean between) {
this.below = below;
this.above = above;
this.between = between;
@@ -60,7 +60,7 @@ public class UnicodeEscaper extends Code
* @param codepoint below which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static UnicodeEscaper below(int codepoint) {
+ public static UnicodeEscaper below(final int codepoint) {
return outsideOf(codepoint, Integer.MAX_VALUE);
}
@@ -70,7 +70,7 @@ public class UnicodeEscaper extends Code
* @param codepoint above which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static UnicodeEscaper above(int codepoint) {
+ public static UnicodeEscaper above(final int codepoint) {
return outsideOf(0, codepoint);
}
@@ -81,7 +81,7 @@ public class UnicodeEscaper extends Code
* @param codepointHigh above which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static UnicodeEscaper outsideOf(int codepointLow, int codepointHigh) {
+ public static UnicodeEscaper outsideOf(final int codepointLow, final int codepointHigh) {
return new UnicodeEscaper(codepointLow, codepointHigh, false);
}
@@ -92,7 +92,7 @@ public class UnicodeEscaper extends Code
* @param codepointHigh below which to escape
* @return the newly created {@code UnicodeEscaper} instance
*/
- public static UnicodeEscaper between(int codepointLow, int codepointHigh) {
+ public static UnicodeEscaper between(final int codepointLow, final int codepointHigh) {
return new UnicodeEscaper(codepointLow, codepointHigh, true);
}
@@ -100,7 +100,7 @@ public class UnicodeEscaper extends Code
* {@inheritDoc}
*/
@Override
- public boolean translate(int codepoint, Writer out) throws IOException {
+ public boolean translate(final int codepoint, final Writer out) throws IOException {
if (between) {
if (codepoint < below || codepoint > above) {
return false;
@@ -126,7 +126,7 @@ public class UnicodeEscaper extends Code
return true;
}
- protected String toUtf16Escape(int codepoint) {
+ protected String toUtf16Escape(final int codepoint) {
return "\\u" + hex(codepoint);
}
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java Tue Jan 22 07:07:42 2013
@@ -33,7 +33,7 @@ public class UnicodeUnescaper extends Ch
* {@inheritDoc}
*/
@Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
+ public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
if (input.charAt(index) == '\\' && index + 1 < input.length() && input.charAt(index + 1) == 'u') {
// consume optional additional 'u' chars
int i = 2;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java Tue Jan 22 07:07:42 2013
@@ -127,7 +127,7 @@ public class DateFormatUtils {
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
*/
- public static String formatUTC(long millis, String pattern) {
+ public static String formatUTC(final long millis, final String pattern) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, null);
}
@@ -138,7 +138,7 @@ public class DateFormatUtils {
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
*/
- public static String formatUTC(Date date, String pattern) {
+ public static String formatUTC(final Date date, final String pattern) {
return format(date, pattern, UTC_TIME_ZONE, null);
}
@@ -150,7 +150,7 @@ public class DateFormatUtils {
* @param locale the locale to use, may be <code>null</code>
* @return the formatted date
*/
- public static String formatUTC(long millis, String pattern, Locale locale) {
+ public static String formatUTC(final long millis, final String pattern, final Locale locale) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, locale);
}
@@ -162,7 +162,7 @@ public class DateFormatUtils {
* @param locale the locale to use, may be <code>null</code>
* @return the formatted date
*/
- public static String formatUTC(Date date, String pattern, Locale locale) {
+ public static String formatUTC(final Date date, final String pattern, final Locale locale) {
return format(date, pattern, UTC_TIME_ZONE, locale);
}
@@ -173,7 +173,7 @@ public class DateFormatUtils {
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
*/
- public static String format(long millis, String pattern) {
+ public static String format(final long millis, final String pattern) {
return format(new Date(millis), pattern, null, null);
}
@@ -184,7 +184,7 @@ public class DateFormatUtils {
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
*/
- public static String format(Date date, String pattern) {
+ public static String format(final Date date, final String pattern) {
return format(date, pattern, null, null);
}
@@ -197,7 +197,7 @@ public class DateFormatUtils {
* @see FastDateFormat#format(Calendar)
* @since 2.4
*/
- public static String format(Calendar calendar, String pattern) {
+ public static String format(final Calendar calendar, final String pattern) {
return format(calendar, pattern, null, null);
}
@@ -209,7 +209,7 @@ public class DateFormatUtils {
* @param timeZone the time zone to use, may be <code>null</code>
* @return the formatted date
*/
- public static String format(long millis, String pattern, TimeZone timeZone) {
+ public static String format(final long millis, final String pattern, final TimeZone timeZone) {
return format(new Date(millis), pattern, timeZone, null);
}
@@ -221,7 +221,7 @@ public class DateFormatUtils {
* @param timeZone the time zone to use, may be <code>null</code>
* @return the formatted date
*/
- public static String format(Date date, String pattern, TimeZone timeZone) {
+ public static String format(final Date date, final String pattern, final TimeZone timeZone) {
return format(date, pattern, timeZone, null);
}
@@ -235,7 +235,7 @@ public class DateFormatUtils {
* @see FastDateFormat#format(Calendar)
* @since 2.4
*/
- public static String format(Calendar calendar, String pattern, TimeZone timeZone) {
+ public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone) {
return format(calendar, pattern, timeZone, null);
}
@@ -247,7 +247,7 @@ public class DateFormatUtils {
* @param locale the locale to use, may be <code>null</code>
* @return the formatted date
*/
- public static String format(long millis, String pattern, Locale locale) {
+ public static String format(final long millis, final String pattern, final Locale locale) {
return format(new Date(millis), pattern, null, locale);
}
@@ -259,7 +259,7 @@ public class DateFormatUtils {
* @param locale the locale to use, may be <code>null</code>
* @return the formatted date
*/
- public static String format(Date date, String pattern, Locale locale) {
+ public static String format(final Date date, final String pattern, final Locale locale) {
return format(date, pattern, null, locale);
}
@@ -273,7 +273,7 @@ public class DateFormatUtils {
* @see FastDateFormat#format(Calendar)
* @since 2.4
*/
- public static String format(Calendar calendar, String pattern, Locale locale) {
+ public static String format(final Calendar calendar, final String pattern, final Locale locale) {
return format(calendar, pattern, null, locale);
}
@@ -286,7 +286,7 @@ public class DateFormatUtils {
* @param locale the locale to use, may be <code>null</code>
* @return the formatted date
*/
- public static String format(long millis, String pattern, TimeZone timeZone, Locale locale) {
+ public static String format(final long millis, final String pattern, final TimeZone timeZone, final Locale locale) {
return format(new Date(millis), pattern, timeZone, locale);
}
@@ -299,7 +299,7 @@ public class DateFormatUtils {
* @param locale the locale to use, may be <code>null</code>
* @return the formatted date
*/
- public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) {
+ public static String format(final Date date, final String pattern, final TimeZone timeZone, final Locale locale) {
FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale);
return df.format(date);
}
@@ -315,7 +315,7 @@ public class DateFormatUtils {
* @see FastDateFormat#format(Calendar)
* @since 2.4
*/
- public static String format(Calendar calendar, String pattern, TimeZone timeZone, Locale locale) {
+ public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone, final Locale locale) {
FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale);
return df.format(calendar);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java Tue Jan 22 07:07:42 2013
@@ -151,7 +151,7 @@ public class DateUtils {
* @throws IllegalArgumentException if either date is <code>null</code>
* @since 2.1
*/
- public static boolean isSameDay(Date date1, Date date2) {
+ public static boolean isSameDay(final Date date1, final Date date2) {
if (date1 == null || date2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -175,7 +175,7 @@ public class DateUtils {
* @throws IllegalArgumentException if either calendar is <code>null</code>
* @since 2.1
*/
- public static boolean isSameDay(Calendar cal1, Calendar cal2) {
+ public static boolean isSameDay(final Calendar cal1, final Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -196,7 +196,7 @@ public class DateUtils {
* @throws IllegalArgumentException if either date is <code>null</code>
* @since 2.1
*/
- public static boolean isSameInstant(Date date1, Date date2) {
+ public static boolean isSameInstant(final Date date1, final Date date2) {
if (date1 == null || date2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -214,7 +214,7 @@ public class DateUtils {
* @throws IllegalArgumentException if either date is <code>null</code>
* @since 2.1
*/
- public static boolean isSameInstant(Calendar cal1, Calendar cal2) {
+ public static boolean isSameInstant(final Calendar cal1, final Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -234,7 +234,7 @@ public class DateUtils {
* @throws IllegalArgumentException if either date is <code>null</code>
* @since 2.1
*/
- public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) {
+ public static boolean isSameLocalTime(final Calendar cal1, final Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -263,7 +263,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date string or pattern array is null
* @throws ParseException if none of the date patterns were suitable (or there were none)
*/
- public static Date parseDate(String str, String... parsePatterns) throws ParseException {
+ public static Date parseDate(final String str, final String... parsePatterns) throws ParseException {
return parseDate(str, null, parsePatterns);
}
@@ -286,7 +286,7 @@ public class DateUtils {
* @throws ParseException if none of the date patterns were suitable (or there were none)
* @since 3.2
*/
- public static Date parseDate(String str, Locale locale, String... parsePatterns) throws ParseException {
+ public static Date parseDate(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
return parseDateWithLeniency(str, locale, parsePatterns, true);
}
@@ -306,7 +306,7 @@ public class DateUtils {
* @throws ParseException if none of the date patterns were suitable
* @since 2.5
*/
- public static Date parseDateStrictly(String str, String... parsePatterns) throws ParseException {
+ public static Date parseDateStrictly(final String str, final String... parsePatterns) throws ParseException {
return parseDateStrictly(str, null, parsePatterns);
}
@@ -328,7 +328,7 @@ public class DateUtils {
* @throws ParseException if none of the date patterns were suitable
* @since 3.2
*/
- public static Date parseDateStrictly(String str, Locale locale, String... parsePatterns) throws ParseException {
+ public static Date parseDateStrictly(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
return parseDateWithLeniency(str, null, parsePatterns, false);
}
@@ -350,7 +350,7 @@ public class DateUtils {
* @see java.util.Calender#isLenient()
*/
private static Date parseDateWithLeniency(
- String str, Locale locale, String[] parsePatterns, boolean lenient) throws ParseException {
+ final String str, final Locale locale, final String[] parsePatterns, final boolean lenient) throws ParseException {
if (str == null || parsePatterns == null) {
throw new IllegalArgumentException("Date and Patterns must not be null");
}
@@ -400,7 +400,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addYears(Date date, int amount) {
+ public static Date addYears(final Date date, final int amount) {
return add(date, Calendar.YEAR, amount);
}
@@ -414,7 +414,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addMonths(Date date, int amount) {
+ public static Date addMonths(final Date date, final int amount) {
return add(date, Calendar.MONTH, amount);
}
@@ -428,7 +428,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addWeeks(Date date, int amount) {
+ public static Date addWeeks(final Date date, final int amount) {
return add(date, Calendar.WEEK_OF_YEAR, amount);
}
@@ -442,7 +442,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addDays(Date date, int amount) {
+ public static Date addDays(final Date date, final int amount) {
return add(date, Calendar.DAY_OF_MONTH, amount);
}
@@ -456,7 +456,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addHours(Date date, int amount) {
+ public static Date addHours(final Date date, final int amount) {
return add(date, Calendar.HOUR_OF_DAY, amount);
}
@@ -470,7 +470,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addMinutes(Date date, int amount) {
+ public static Date addMinutes(final Date date, final int amount) {
return add(date, Calendar.MINUTE, amount);
}
@@ -484,7 +484,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addSeconds(Date date, int amount) {
+ public static Date addSeconds(final Date date, final int amount) {
return add(date, Calendar.SECOND, amount);
}
@@ -498,7 +498,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- public static Date addMilliseconds(Date date, int amount) {
+ public static Date addMilliseconds(final Date date, final int amount) {
return add(date, Calendar.MILLISECOND, amount);
}
@@ -513,7 +513,7 @@ public class DateUtils {
* @return the new {@code Date} with the amount added
* @throws IllegalArgumentException if the date is null
*/
- private static Date add(Date date, int calendarField, int amount) {
+ private static Date add(final Date date, final int calendarField, final int amount) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -534,7 +534,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setYears(Date date, int amount) {
+ public static Date setYears(final Date date, final int amount) {
return set(date, Calendar.YEAR, amount);
}
@@ -549,7 +549,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setMonths(Date date, int amount) {
+ public static Date setMonths(final Date date, final int amount) {
return set(date, Calendar.MONTH, amount);
}
@@ -564,7 +564,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setDays(Date date, int amount) {
+ public static Date setDays(final Date date, final int amount) {
return set(date, Calendar.DAY_OF_MONTH, amount);
}
@@ -580,7 +580,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setHours(Date date, int amount) {
+ public static Date setHours(final Date date, final int amount) {
return set(date, Calendar.HOUR_OF_DAY, amount);
}
@@ -595,7 +595,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setMinutes(Date date, int amount) {
+ public static Date setMinutes(final Date date, final int amount) {
return set(date, Calendar.MINUTE, amount);
}
@@ -610,7 +610,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setSeconds(Date date, int amount) {
+ public static Date setSeconds(final Date date, final int amount) {
return set(date, Calendar.SECOND, amount);
}
@@ -625,7 +625,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- public static Date setMilliseconds(Date date, int amount) {
+ public static Date setMilliseconds(final Date date, final int amount) {
return set(date, Calendar.MILLISECOND, amount);
}
@@ -642,7 +642,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is null
* @since 2.4
*/
- private static Date set(Date date, int calendarField, int amount) {
+ private static Date set(final Date date, final int calendarField, final int amount) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -663,7 +663,7 @@ public class DateUtils {
* @throws NullPointerException if null is passed in
* @since 3.0
*/
- public static Calendar toCalendar(Date date) {
+ public static Calendar toCalendar(final Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c;
@@ -696,7 +696,7 @@ public class DateUtils {
* @return the different rounded date, not null
* @throws ArithmeticException if the year is over 280 million
*/
- public static Date round(Date date, int field) {
+ public static Date round(final Date date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -733,7 +733,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is <code>null</code>
* @throws ArithmeticException if the year is over 280 million
*/
- public static Calendar round(Calendar date, int field) {
+ public static Calendar round(final Calendar date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -770,7 +770,7 @@ public class DateUtils {
* @throws ClassCastException if the object type is not a {@code Date} or {@code Calendar}
* @throws ArithmeticException if the year is over 280 million
*/
- public static Date round(Object date, int field) {
+ public static Date round(final Object date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -799,7 +799,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is <code>null</code>
* @throws ArithmeticException if the year is over 280 million
*/
- public static Date truncate(Date date, int field) {
+ public static Date truncate(final Date date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -824,7 +824,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is <code>null</code>
* @throws ArithmeticException if the year is over 280 million
*/
- public static Calendar truncate(Calendar date, int field) {
+ public static Calendar truncate(final Calendar date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -849,7 +849,7 @@ public class DateUtils {
* @throws ClassCastException if the object type is not a {@code Date} or {@code Calendar}
* @throws ArithmeticException if the year is over 280 million
*/
- public static Date truncate(Object date, int field) {
+ public static Date truncate(final Object date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -879,7 +879,7 @@ public class DateUtils {
* @throws ArithmeticException if the year is over 280 million
* @since 2.5
*/
- public static Date ceiling(Date date, int field) {
+ public static Date ceiling(final Date date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -905,7 +905,7 @@ public class DateUtils {
* @throws ArithmeticException if the year is over 280 million
* @since 2.5
*/
- public static Calendar ceiling(Calendar date, int field) {
+ public static Calendar ceiling(final Calendar date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -931,7 +931,7 @@ public class DateUtils {
* @throws ArithmeticException if the year is over 280 million
* @since 2.5
*/
- public static Date ceiling(Object date, int field) {
+ public static Date ceiling(final Object date, final int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -953,7 +953,7 @@ public class DateUtils {
* @param modType type to truncate, round or ceiling
* @throws ArithmeticException if the year is over 280 million
*/
- private static void modify(Calendar val, int field, int modType) {
+ private static void modify(final Calendar val, final int field, final int modType) {
if (val.get(Calendar.YEAR) > 280000000) {
throw new ArithmeticException("Calendar value too large for accurate calculations");
}
@@ -1116,7 +1116,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is <code>null</code>
* @throws IllegalArgumentException if the rangeStyle is invalid
*/
- public static Iterator<Calendar> iterator(Date focus, int rangeStyle) {
+ public static Iterator<Calendar> iterator(final Date focus, final int rangeStyle) {
if (focus == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -1149,7 +1149,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is <code>null</code>
* @throws IllegalArgumentException if the rangeStyle is invalid
*/
- public static Iterator<Calendar> iterator(Calendar focus, int rangeStyle) {
+ public static Iterator<Calendar> iterator(final Calendar focus, final int rangeStyle) {
if (focus == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -1237,7 +1237,7 @@ public class DateUtils {
* @throws IllegalArgumentException if the date is <code>null</code>
* @throws ClassCastException if the object type is not a {@code Date} or {@code Calendar}
*/
- public static Iterator<?> iterator(Object focus, int rangeStyle) {
+ public static Iterator<?> iterator(final Object focus, final int rangeStyle) {
if (focus == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -1283,7 +1283,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInMilliseconds(Date date, int fragment) {
+ public static long getFragmentInMilliseconds(final Date date, final int fragment) {
return getFragment(date, fragment, Calendar.MILLISECOND);
}
@@ -1323,7 +1323,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInSeconds(Date date, int fragment) {
+ public static long getFragmentInSeconds(final Date date, final int fragment) {
return getFragment(date, fragment, Calendar.SECOND);
}
@@ -1363,7 +1363,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInMinutes(Date date, int fragment) {
+ public static long getFragmentInMinutes(final Date date, final int fragment) {
return getFragment(date, fragment, Calendar.MINUTE);
}
@@ -1403,7 +1403,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInHours(Date date, int fragment) {
+ public static long getFragmentInHours(final Date date, final int fragment) {
return getFragment(date, fragment, Calendar.HOUR_OF_DAY);
}
@@ -1443,7 +1443,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInDays(Date date, int fragment) {
+ public static long getFragmentInDays(final Date date, final int fragment) {
return getFragment(date, fragment, Calendar.DAY_OF_YEAR);
}
@@ -1483,7 +1483,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInMilliseconds(Calendar calendar, int fragment) {
+ public static long getFragmentInMilliseconds(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, Calendar.MILLISECOND);
}
/**
@@ -1522,7 +1522,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInSeconds(Calendar calendar, int fragment) {
+ public static long getFragmentInSeconds(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, Calendar.SECOND);
}
@@ -1562,7 +1562,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInMinutes(Calendar calendar, int fragment) {
+ public static long getFragmentInMinutes(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, Calendar.MINUTE);
}
@@ -1602,7 +1602,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInHours(Calendar calendar, int fragment) {
+ public static long getFragmentInHours(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, Calendar.HOUR_OF_DAY);
}
@@ -1644,7 +1644,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- public static long getFragmentInDays(Calendar calendar, int fragment) {
+ public static long getFragmentInDays(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, Calendar.DAY_OF_YEAR);
}
@@ -1659,7 +1659,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- private static long getFragment(Date date, int fragment, int unit) {
+ private static long getFragment(final Date date, final int fragment, final int unit) {
if(date == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -1679,7 +1679,7 @@ public class DateUtils {
* fragment is not supported
* @since 2.4
*/
- private static long getFragment(Calendar calendar, int fragment, int unit) {
+ private static long getFragment(final Calendar calendar, final int fragment, final int unit) {
if(calendar == null) {
throw new IllegalArgumentException("The date must not be null");
}
@@ -1734,7 +1734,7 @@ public class DateUtils {
* @see #truncatedEquals(Date, Date, int)
* @since 3.0
*/
- public static boolean truncatedEquals(Calendar cal1, Calendar cal2, int field) {
+ public static boolean truncatedEquals(final Calendar cal1, final Calendar cal2, final int field) {
return truncatedCompareTo(cal1, cal2, field) == 0;
}
@@ -1751,7 +1751,7 @@ public class DateUtils {
* @see #truncatedEquals(Calendar, Calendar, int)
* @since 3.0
*/
- public static boolean truncatedEquals(Date date1, Date date2, int field) {
+ public static boolean truncatedEquals(final Date date1, final Date date2, final int field) {
return truncatedCompareTo(date1, date2, field) == 0;
}
@@ -1769,7 +1769,7 @@ public class DateUtils {
* @see #truncatedCompareTo(Date, Date, int)
* @since 3.0
*/
- public static int truncatedCompareTo(Calendar cal1, Calendar cal2, int field) {
+ public static int truncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field) {
Calendar truncatedCal1 = truncate(cal1, field);
Calendar truncatedCal2 = truncate(cal2, field);
return truncatedCal1.compareTo(truncatedCal2);
@@ -1789,7 +1789,7 @@ public class DateUtils {
* @see #truncatedCompareTo(Date, Date, int)
* @since 3.0
*/
- public static int truncatedCompareTo(Date date1, Date date2, int field) {
+ public static int truncatedCompareTo(final Date date1, final Date date2, final int field) {
Date truncatedDate1 = truncate(date1, field);
Date truncatedDate2 = truncate(date2, field);
return truncatedDate1.compareTo(truncatedDate2);
@@ -1804,7 +1804,7 @@ public class DateUtils {
* @throws IllegalArgumentException if date can't be represented in milliseconds
* @since 2.4
*/
- private static long getMillisPerUnit(int unit) {
+ private static long getMillisPerUnit(final int unit) {
long result = Long.MAX_VALUE;
switch (unit) {
case Calendar.DAY_OF_YEAR:
@@ -1842,7 +1842,7 @@ public class DateUtils {
* @param startFinal start date (inclusive)
* @param endFinal end date (inclusive)
*/
- DateIterator(Calendar startFinal, Calendar endFinal) {
+ DateIterator(final Calendar startFinal, final Calendar endFinal) {
super();
this.endFinal = endFinal;
spot = startFinal;
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java Tue Jan 22 07:07:42 2013
@@ -72,7 +72,7 @@ public class DurationFormatUtils {
* @param durationMillis the duration to format
* @return the formatted duration, not null
*/
- public static String formatDurationHMS(long durationMillis) {
+ public static String formatDurationHMS(final long durationMillis) {
return formatDuration(durationMillis, "H:mm:ss.SSS");
}
@@ -87,7 +87,7 @@ public class DurationFormatUtils {
* @param durationMillis the duration to format
* @return the formatted duration, not null
*/
- public static String formatDurationISO(long durationMillis) {
+ public static String formatDurationISO(final long durationMillis) {
return formatDuration(durationMillis, ISO_EXTENDED_FORMAT_PATTERN, false);
}
@@ -102,7 +102,7 @@ public class DurationFormatUtils {
* @param format the way in which to format the duration, not null
* @return the formatted duration, not null
*/
- public static String formatDuration(long durationMillis, String format) {
+ public static String formatDuration(final long durationMillis, final String format) {
return formatDuration(durationMillis, format, true);
}
@@ -119,7 +119,7 @@ public class DurationFormatUtils {
* @param padWithZeros whether to pad the left hand side of numbers with 0's
* @return the formatted duration, not null
*/
- public static String formatDuration(long durationMillis, String format, boolean padWithZeros) {
+ public static String formatDuration(long durationMillis, final String format, final boolean padWithZeros) {
Token[] tokens = lexx(format);
@@ -164,9 +164,9 @@ public class DurationFormatUtils {
* @return the formatted text in days/hours/minutes/seconds, not null
*/
public static String formatDurationWords(
- long durationMillis,
- boolean suppressLeadingZeroElements,
- boolean suppressTrailingZeroElements) {
+ final long durationMillis,
+ final boolean suppressLeadingZeroElements,
+ final boolean suppressTrailingZeroElements) {
// This method is generally replacable by the format method, but
// there are a series of tweaks and special cases that require
@@ -226,7 +226,7 @@ public class DurationFormatUtils {
* @param endMillis the end of the duration to format
* @return the formatted duration, not null
*/
- public static String formatPeriodISO(long startMillis, long endMillis) {
+ public static String formatPeriodISO(final long startMillis, final long endMillis) {
return formatPeriod(startMillis, endMillis, ISO_EXTENDED_FORMAT_PATTERN, false, TimeZone.getDefault());
}
@@ -239,7 +239,7 @@ public class DurationFormatUtils {
* @param format the way in which to format the duration, not null
* @return the formatted duration, not null
*/
- public static String formatPeriod(long startMillis, long endMillis, String format) {
+ public static String formatPeriod(final long startMillis, final long endMillis, final String format) {
return formatPeriod(startMillis, endMillis, format, true, TimeZone.getDefault());
}
@@ -266,8 +266,8 @@ public class DurationFormatUtils {
* @param timezone the millis are defined in
* @return the formatted duration, not null
*/
- public static String formatPeriod(long startMillis, long endMillis, String format, boolean padWithZeros,
- TimeZone timezone) {
+ public static String formatPeriod(final long startMillis, final long endMillis, final String format, final boolean padWithZeros,
+ final TimeZone timezone) {
// Used to optimise for differences under 28 days and
// called formatDuration(millis, format); however this did not work
@@ -411,8 +411,8 @@ public class DurationFormatUtils {
* @param padWithZeros whether to pad
* @return the formatted string
*/
- static String format(Token[] tokens, int years, int months, int days, int hours, int minutes, int seconds,
- int milliseconds, boolean padWithZeros) {
+ static String format(final Token[] tokens, final int years, final int months, final int days, final int hours, final int minutes, final int seconds,
+ int milliseconds, final boolean padWithZeros) {
StringBuilder buffer = new StringBuilder();
boolean lastOutputSeconds = false;
int sz = tokens.length;
@@ -480,7 +480,7 @@ public class DurationFormatUtils {
* @param format the format to parse, not null
* @return array of Token[]
*/
- static Token[] lexx(String format) {
+ static Token[] lexx(final String format) {
char[] array = format.toCharArray();
ArrayList<Token> list = new ArrayList<Token>(array.length);
@@ -551,7 +551,7 @@ public class DurationFormatUtils {
* @param value to look for
* @return boolean <code>true</code> if contained
*/
- static boolean containsTokenWithValue(Token[] tokens, Object value) {
+ static boolean containsTokenWithValue(final Token[] tokens, final Object value) {
int sz = tokens.length;
for (int i = 0; i < sz; i++) {
if (tokens[i].getValue() == value) {
@@ -569,7 +569,7 @@ public class DurationFormatUtils {
*
* @param value to wrap
*/
- Token(Object value) {
+ Token(final Object value) {
this.value = value;
this.count = 1;
}
@@ -581,7 +581,7 @@ public class DurationFormatUtils {
* @param value to wrap
* @param count to wrap
*/
- Token(Object value, int count) {
+ Token(final Object value, final int count) {
this.value = value;
this.count = count;
}
@@ -618,7 +618,7 @@ public class DurationFormatUtils {
* @return boolean <code>true</code> if equal
*/
@Override
- public boolean equals(Object obj2) {
+ public boolean equals(final Object obj2) {
if (obj2 instanceof Token) {
Token tok2 = (Token) obj2;
if (this.value.getClass() != tok2.value.getClass()) {
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java Tue Jan 22 07:07:42 2013
@@ -87,7 +87,7 @@ public class FastDateFormat extends Form
private static final FormatCache<FastDateFormat> cache= new FormatCache<FastDateFormat>() {
@Override
- protected FastDateFormat createInstance(String pattern, TimeZone timeZone, Locale locale) {
+ protected FastDateFormat createInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return new FastDateFormat(pattern, timeZone, locale);
}
};
@@ -115,7 +115,7 @@ public class FastDateFormat extends Form
* @return a pattern based date/time formatter
* @throws IllegalArgumentException if pattern is invalid
*/
- public static FastDateFormat getInstance(String pattern) {
+ public static FastDateFormat getInstance(final String pattern) {
return cache.getInstance(pattern, null, null);
}
@@ -130,7 +130,7 @@ public class FastDateFormat extends Form
* @return a pattern based date/time formatter
* @throws IllegalArgumentException if pattern is invalid
*/
- public static FastDateFormat getInstance(String pattern, TimeZone timeZone) {
+ public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone) {
return cache.getInstance(pattern, timeZone, null);
}
@@ -144,7 +144,7 @@ public class FastDateFormat extends Form
* @return a pattern based date/time formatter
* @throws IllegalArgumentException if pattern is invalid
*/
- public static FastDateFormat getInstance(String pattern, Locale locale) {
+ public static FastDateFormat getInstance(final String pattern, final Locale locale) {
return cache.getInstance(pattern, null, locale);
}
@@ -161,7 +161,7 @@ public class FastDateFormat extends Form
* @throws IllegalArgumentException if pattern is invalid
* or {@code null}
*/
- public static FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) {
+ public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return cache.getInstance(pattern, timeZone, locale);
}
@@ -176,7 +176,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getDateInstance(int style) {
+ public static FastDateFormat getDateInstance(final int style) {
return cache.getDateTimeInstance(style, null, null, null);
}
@@ -191,7 +191,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getDateInstance(int style, Locale locale) {
+ public static FastDateFormat getDateInstance(final int style, final Locale locale) {
return cache.getDateTimeInstance(style, null, null, locale);
}
@@ -207,7 +207,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getDateInstance(int style, TimeZone timeZone) {
+ public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone) {
return cache.getDateTimeInstance(style, null, timeZone, null);
}
@@ -223,7 +223,7 @@ public class FastDateFormat extends Form
* @throws IllegalArgumentException if the Locale has no date
* pattern defined
*/
- public static FastDateFormat getDateInstance(int style, TimeZone timeZone, Locale locale) {
+ public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) {
return cache.getDateTimeInstance(style, null, timeZone, locale);
}
@@ -238,7 +238,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getTimeInstance(int style) {
+ public static FastDateFormat getTimeInstance(final int style) {
return cache.getDateTimeInstance(null, style, null, null);
}
@@ -253,7 +253,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getTimeInstance(int style, Locale locale) {
+ public static FastDateFormat getTimeInstance(final int style, final Locale locale) {
return cache.getDateTimeInstance(null, style, null, locale);
}
@@ -269,7 +269,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getTimeInstance(int style, TimeZone timeZone) {
+ public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) {
return cache.getDateTimeInstance(null, style, timeZone, null);
}
@@ -285,7 +285,7 @@ public class FastDateFormat extends Form
* @throws IllegalArgumentException if the Locale has no time
* pattern defined
*/
- public static FastDateFormat getTimeInstance(int style, TimeZone timeZone, Locale locale) {
+ public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
return cache.getDateTimeInstance(null, style, timeZone, locale);
}
@@ -301,7 +301,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
+ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) {
return cache.getDateTimeInstance(dateStyle, timeStyle, null, null);
}
@@ -317,7 +317,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
+ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final Locale locale) {
return cache.getDateTimeInstance(dateStyle, timeStyle, null, locale);
}
@@ -334,7 +334,7 @@ public class FastDateFormat extends Form
* pattern defined
* @since 2.1
*/
- public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone) {
+ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone) {
return getDateTimeInstance(dateStyle, timeStyle, timeZone, null);
}
/**
@@ -351,7 +351,7 @@ public class FastDateFormat extends Form
* pattern defined
*/
public static FastDateFormat getDateTimeInstance(
- int dateStyle, int timeStyle, TimeZone timeZone, Locale locale) {
+ final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
}
@@ -365,7 +365,7 @@ public class FastDateFormat extends Form
* @param locale non-null locale to use
* @throws NullPointerException if pattern, timeZone, or locale is null.
*/
- protected FastDateFormat(String pattern, TimeZone timeZone, Locale locale) {
+ protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) {
printer= new FastDatePrinter(pattern, timeZone, locale);
parser= new FastDateParser(pattern, timeZone, locale);
}
@@ -382,7 +382,7 @@ public class FastDateFormat extends Form
* @return the buffer passed in
*/
@Override
- public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
+ public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
return printer.format(obj, toAppendTo, pos);
}
@@ -394,7 +394,7 @@ public class FastDateFormat extends Form
* @since 2.1
*/
@Override
- public String format(long millis) {
+ public String format(final long millis) {
return printer.format(millis);
}
@@ -405,7 +405,7 @@ public class FastDateFormat extends Form
* @return the formatted string
*/
@Override
- public String format(Date date) {
+ public String format(final Date date) {
return printer.format(date);
}
@@ -416,7 +416,7 @@ public class FastDateFormat extends Form
* @return the formatted string
*/
@Override
- public String format(Calendar calendar) {
+ public String format(final Calendar calendar) {
return printer.format(calendar);
}
@@ -430,7 +430,7 @@ public class FastDateFormat extends Form
* @since 2.1
*/
@Override
- public StringBuffer format(long millis, StringBuffer buf) {
+ public StringBuffer format(final long millis, final StringBuffer buf) {
return printer.format(millis, buf);
}
@@ -443,7 +443,7 @@ public class FastDateFormat extends Form
* @return the specified string buffer
*/
@Override
- public StringBuffer format(Date date, StringBuffer buf) {
+ public StringBuffer format(final Date date, final StringBuffer buf) {
return printer.format(date, buf);
}
@@ -456,7 +456,7 @@ public class FastDateFormat extends Form
* @return the specified string buffer
*/
@Override
- public StringBuffer format(Calendar calendar, StringBuffer buf) {
+ public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
return printer.format(calendar, buf);
}
@@ -468,7 +468,7 @@ public class FastDateFormat extends Form
* @see DateParser#parse(java.lang.String)
*/
@Override
- public Date parse(String source) throws ParseException {
+ public Date parse(final String source) throws ParseException {
return parser.parse(source);
}
@@ -476,7 +476,7 @@ public class FastDateFormat extends Form
* @see DateParser#parse(java.lang.String, java.text.ParsePosition)
*/
@Override
- public Date parse(String source, ParsePosition pos) {
+ public Date parse(final String source, final ParsePosition pos) {
return parser.parse(source, pos);
}
@@ -484,7 +484,7 @@ public class FastDateFormat extends Form
* @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
*/
@Override
- public Object parseObject(String source, ParsePosition pos) {
+ public Object parseObject(final String source, final ParsePosition pos) {
return parser.parseObject(source, pos);
}
@@ -544,7 +544,7 @@ public class FastDateFormat extends Form
* @return {@code true} if equal
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj instanceof FastDateFormat == false) {
return false;
}
@@ -582,7 +582,7 @@ public class FastDateFormat extends Form
* @param buf the buffer to format into
* @return the specified string buffer
*/
- protected StringBuffer applyRules(Calendar calendar, StringBuffer buf) {
+ protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
return printer.applyRules(calendar, buf);
}
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java?rev=1436768&r1=1436767&r2=1436768&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java Tue Jan 22 07:07:42 2013
@@ -94,7 +94,7 @@ public class FastDateParser implements D
* @param timeZone non-null time zone to use
* @param locale non-null locale
*/
- protected FastDateParser(String pattern, TimeZone timeZone, Locale locale) {
+ protected FastDateParser(final String pattern, final TimeZone timeZone, final Locale locale) {
this.pattern = pattern;
this.timeZone = timeZone;
this.locale = locale;
@@ -185,7 +185,7 @@ public class FastDateParser implements D
* @return <code>true</code>if equal to this instance
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (! (obj instanceof FastDateParser) ) {
return false;
}
@@ -225,7 +225,7 @@ public class FastDateParser implements D
* @throws IOException if there is an IO issue.
* @throws ClassNotFoundException if a class cannot be found.
*/
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
init();
}
@@ -234,7 +234,7 @@ public class FastDateParser implements D
* @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String)
*/
@Override
- public Object parseObject(String source) throws ParseException {
+ public Object parseObject(final String source) throws ParseException {
return parse(source);
}
@@ -242,7 +242,7 @@ public class FastDateParser implements D
* @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String)
*/
@Override
- public Date parse(String source) throws ParseException {
+ public Date parse(final String source) throws ParseException {
Date date= parse(source, new ParsePosition(0));
if(date==null) {
// Add a note re supported date range
@@ -260,7 +260,7 @@ public class FastDateParser implements D
* @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String, java.text.ParsePosition)
*/
@Override
- public Object parseObject(String source, ParsePosition pos) {
+ public Object parseObject(final String source, final ParsePosition pos) {
return parse(source, pos);
}
@@ -268,7 +268,7 @@ public class FastDateParser implements D
* @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String, java.text.ParsePosition)
*/
@Override
- public Date parse(String source, ParsePosition pos) {
+ public Date parse(final String source, final ParsePosition pos) {
int offset= pos.getIndex();
Matcher matcher= parsePattern.matcher(source.substring(offset));
if(!matcher.lookingAt()) {
@@ -296,7 +296,7 @@ public class FastDateParser implements D
* @param unquote If true, replace two success quotes ('') with single quote (')
* @return The <code>StringBuilder</code>
*/
- private static StringBuilder escapeRegex(StringBuilder regex, String value, boolean unquote) {
+ private static StringBuilder escapeRegex(final StringBuilder regex, final String value, final boolean unquote) {
regex.append("\\Q");
for(int i= 0; i<value.length(); ++i) {
char c= value.charAt(i);
@@ -342,7 +342,7 @@ public class FastDateParser implements D
* @param locale The locale of display names
* @return A Map of the field key / value pairs
*/
- private static Map<String, Integer> getDisplayNames(int field, Calendar definingCalendar, Locale locale) {
+ private static Map<String, Integer> getDisplayNames(final int field, final Calendar definingCalendar, final Locale locale) {
return definingCalendar.getDisplayNames(field, Calendar.ALL_STYLES, locale);
}
@@ -351,7 +351,7 @@ public class FastDateParser implements D
* @param twoDigitYear The year to adjust
* @return A value within -80 and +20 years from instantiation of this instance
*/
- int adjustYear(int twoDigitYear) {
+ int adjustYear(final int twoDigitYear) {
int trial= twoDigitYear + thisYear - thisYear%100;
if(trial < thisYear+20) {
return trial;
@@ -397,7 +397,7 @@ public class FastDateParser implements D
* @param cal The <code>Calendar</code> to set
* @param value The parsed field to translate and set in cal
*/
- void setCalendar(FastDateParser parser, Calendar cal, String value) {
+ void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
}
/**
@@ -424,7 +424,7 @@ public class FastDateParser implements D
* @param definingCalendar The calendar to obtain the short and long values
* @return The Strategy that will handle parsing for the field
*/
- private Strategy getStrategy(String formatField, Calendar definingCalendar) {
+ private Strategy getStrategy(String formatField, final Calendar definingCalendar) {
switch(formatField.charAt(0)) {
case '\'':
if(formatField.length()>2) {
@@ -481,7 +481,7 @@ public class FastDateParser implements D
* @param field The Calendar field
* @return a cache of Locale to Strategy
*/
- private static ConcurrentMap<Locale, Strategy> getCache(int field) {
+ private static ConcurrentMap<Locale, Strategy> getCache(final int field) {
synchronized(caches) {
if(caches[field]==null) {
caches[field]= new ConcurrentHashMap<Locale,Strategy>(3);
@@ -497,7 +497,7 @@ public class FastDateParser implements D
* @param definingCalendar The calendar to obtain the short and long values
* @return a TextStrategy for the field and Locale
*/
- private Strategy getLocaleSpecificStrategy(int field, Calendar definingCalendar) {
+ private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
ConcurrentMap<Locale,Strategy> cache = getCache(field);
Strategy strategy= cache.get(Integer.valueOf(field));
if(strategy==null) {
@@ -522,7 +522,7 @@ public class FastDateParser implements D
* Construct a Strategy that ensures the formatField has literal text
* @param formatField The literal text to match
*/
- CopyQuotedStrategy(String formatField) {
+ CopyQuotedStrategy(final String formatField) {
this.formatField= formatField;
}
@@ -542,7 +542,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- boolean addRegex(FastDateParser parser, StringBuilder regex) {
+ boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
escapeRegex(regex, formatField, true);
return false;
}
@@ -559,7 +559,7 @@ public class FastDateParser implements D
* Construct a Strategy that parses a Text field
* @param field The Calendar field
*/
- TextStrategy(int field, Calendar definingCalendar, Locale locale) {
+ TextStrategy(final int field, final Calendar definingCalendar, final Locale locale) {
this.field= field;
this.keyValues= getDisplayNames(field, definingCalendar, locale);
}
@@ -568,7 +568,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- boolean addRegex(FastDateParser parser, StringBuilder regex) {
+ boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
regex.append('(');
for(String textKeyValue : keyValues.keySet()) {
escapeRegex(regex, textKeyValue, false).append('|');
@@ -581,7 +581,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- void setCalendar(FastDateParser parser, Calendar cal, String value) {
+ void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
Integer iVal = keyValues.get(value);
if(iVal == null) {
StringBuilder sb= new StringBuilder(value);
@@ -607,7 +607,7 @@ public class FastDateParser implements D
* Construct a Strategy that parses a Number field
* @param field The Calendar field
*/
- NumberStrategy(int field) {
+ NumberStrategy(final int field) {
this.field= field;
}
@@ -623,7 +623,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- boolean addRegex(FastDateParser parser, StringBuilder regex) {
+ boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
if(parser.isNextNumber()) {
regex.append("(\\p{IsNd}{").append(parser.getFieldWidth()).append("}+)");
}
@@ -637,7 +637,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- void setCalendar(FastDateParser parser, Calendar cal, String value) {
+ void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
cal.set(field, modify(Integer.parseInt(value)));
}
@@ -646,7 +646,7 @@ public class FastDateParser implements D
* @param iValue The parsed integer
* @return The modified value
*/
- int modify(int iValue) {
+ int modify(final int iValue) {
return iValue;
}
}
@@ -656,7 +656,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- void setCalendar(FastDateParser parser, Calendar cal, String value) {
+ void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
int iValue= Integer.parseInt(value);
if(iValue<100) {
iValue= parser.adjustYear(iValue);
@@ -677,7 +677,7 @@ public class FastDateParser implements D
* Construct a Strategy that parses a TimeZone
* @param locale The Locale
*/
- TimeZoneStrategy(Locale locale) {
+ TimeZoneStrategy(final Locale locale) {
for(String id : TimeZone.getAvailableIDs()) {
if(id.startsWith("GMT")) {
continue;
@@ -703,7 +703,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- boolean addRegex(FastDateParser parser, StringBuilder regex) {
+ boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
regex.append(validTimeZoneChars);
return true;
}
@@ -712,7 +712,7 @@ public class FastDateParser implements D
* {@inheritDoc}
*/
@Override
- void setCalendar(FastDateParser parser, Calendar cal, String value) {
+ void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
TimeZone tz;
if(value.charAt(0)=='+' || value.charAt(0)=='-') {
tz= TimeZone.getTimeZone("GMT"+value);
@@ -732,7 +732,7 @@ public class FastDateParser implements D
private static final Strategy NUMBER_MONTH_STRATEGY = new NumberStrategy(Calendar.MONTH) {
@Override
- int modify(int iValue) {
+ int modify(final int iValue) {
return iValue-1;
}
};
@@ -745,13 +745,13 @@ public class FastDateParser implements D
private static final Strategy HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY);
private static final Strategy MODULO_HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY) {
@Override
- int modify(int iValue) {
+ int modify(final int iValue) {
return iValue%24;
}
};
private static final Strategy MODULO_HOUR_STRATEGY = new NumberStrategy(Calendar.HOUR) {
@Override
- int modify(int iValue) {
+ int modify(final int iValue) {
return iValue%12;
}
};