This commit is contained in:
Keith Donald 2009-11-09 21:10:51 +00:00
parent 6f4112af80
commit 835b958911
2 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@ import java.lang.annotation.Target;
/** /**
* Declares that a field should be formatted as a ISO date time. * Declares that a field should be formatted as a ISO date time.
* Can be applied to <code>java.util.Date</code>, <code>java.util.Calendar</code>, <code>java.long.Long</code>, or Joda Time fields.
* @author Keith Donald * @author Keith Donald
* @since 3.0 * @since 3.0
*/ */

View File

@ -28,10 +28,10 @@ import org.springframework.format.annotation.ISODateTimeFormat.ISO;
public final class ISODateTimeFormatAnnotationFormatterFactory extends AbstractDateTimeAnnotationFormatterFactory<ISODateTimeFormat> { public final class ISODateTimeFormatAnnotationFormatterFactory extends AbstractDateTimeAnnotationFormatterFactory<ISODateTimeFormat> {
protected DateTimeFormatter configureDateTimeFormatterFrom(ISODateTimeFormat annotation) { protected DateTimeFormatter configureDateTimeFormatterFrom(ISODateTimeFormat annotation) {
ISO style = annotation.value(); ISO format = annotation.value();
if (style == ISO.DATE) { if (format == ISO.DATE) {
return org.joda.time.format.ISODateTimeFormat.date(); return org.joda.time.format.ISODateTimeFormat.date();
} else if (style == ISO.TIME) { } else if (format == ISO.TIME) {
return org.joda.time.format.ISODateTimeFormat.time(); return org.joda.time.format.ISODateTimeFormat.time();
} else { } else {
return org.joda.time.format.ISODateTimeFormat.dateTime(); return org.joda.time.format.ISODateTimeFormat.dateTime();