[
https://issues.apache.org/jira/browse/LANG-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sebb resolved LANG-884.
-----------------------
Resolution: Fixed
Fix Version/s: 3.2
URL: http://svn.apache.org/r1477507
Log:
LANG-884 Simplify FastDateFormat; eliminate boxing
Modified:
commons/proper/lang/trunk/src/changes/changes.xml
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FormatCache.java
> Simplify FastDateFormat; eliminate boxing
> -----------------------------------------
>
> Key: LANG-884
> URL: https://issues.apache.org/jira/browse/LANG-884
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.time.*
> Affects Versions: 3.1
> Reporter: Sebb
> Fix For: 3.2
>
> Attachments: LANG-884.patch
>
>
> FastDateFormat calls the method FormatCache.getDateTimeInstance(Integer,
> Integer, ...) several times. There are some issues with this:
> - the two Integer parameters could be mixed up
> - the int parameters have to be boxed into Integers
> - the FastDateFormat class has to 'know' that FormatCache uses null for no
> date/no time.
> The FormatCache class could be extended to add getDate, getTime and
> getDateTime methods with int parameters, and the calling sequences would them
> be a lot more obvious. Instead of:
> {code}
> public static FastDateFormat getDateInstance(final int style) {
> return cache.getDateTimeInstance(style, null, null, null);
> }
> {code}
> one could write:
> {code}
> public static FastDateFormat getDateInstance(final int style) {
> return cache.getDateInstance(style, null, null);
> }
> {code}
> The FormatCache class would then be responsible for boxing the date and time
> int values as necessary.
> As well as simplifying the FastDateFormat code, it would also allow the
> FormatCache code to be reworked. Only it would know that null is currently
> used for a missing date or time; and it could be changed to use a different
> representation if that was better.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira