Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
chenpeng_fei
spring-framework
提交
cef5f022
S
spring-framework
项目概览
chenpeng_fei
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cef5f022
编写于
11月 04, 2012
作者:
S
Sam Brannen
提交者:
Chris Beams
11月 04, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish Javadoc and imports in datetime package
Issue: SPR-7121
上级
dc0a0df8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
33 deletion
+35
-33
spring-context/src/main/java/org/springframework/format/datetime/DateFormatterRegistrar.java
...ringframework/format/datetime/DateFormatterRegistrar.java
+4
-5
spring-context/src/main/java/org/springframework/format/datetime/DateTimeFormatAnnotationFormatterFactory.java
...at/datetime/DateTimeFormatAnnotationFormatterFactory.java
+3
-3
spring-context/src/main/java/org/springframework/format/datetime/joda/DateTimeFormatterFactory.java
...mework/format/datetime/joda/DateTimeFormatterFactory.java
+17
-15
spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java
...me/joda/JodaDateTimeFormatAnnotationFormatterFactory.java
+1
-0
spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java
...work/format/datetime/joda/JodaTimeFormatterRegistrar.java
+10
-10
未找到文件。
spring-context/src/main/java/org/springframework/format/datetime/DateFormatterRegistrar.java
浏览文件 @
cef5f022
...
...
@@ -23,19 +23,18 @@ import org.springframework.core.convert.converter.Converter;
import
org.springframework.core.convert.converter.ConverterRegistry
;
import
org.springframework.format.FormatterRegistrar
;
import
org.springframework.format.FormatterRegistry
;
import
org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar
;
import
org.springframework.util.Assert
;
/**
* Configures Date formatting for use with Spring.
* <p>
* Designed for direct instantiation but also exposes the static
* {@link #addDateConverters(ConverterRegistry)} utility method for ad hoc use
against any
* {@code ConverterRegistry} instance.
* {@link #addDateConverters(ConverterRegistry)} utility method for ad hoc use
*
against any
{@code ConverterRegistry} instance.
*
* @author Phillip Webb
* @since 3.2
* @see JodaTimeFormatterRegistrar
* @see
org.springframework.format.datetime.joda.
JodaTimeFormatterRegistrar
* @see FormatterRegistrar#registerFormatters
*/
public
class
DateFormatterRegistrar
implements
FormatterRegistrar
{
...
...
@@ -52,7 +51,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
}
/**
* Set the date formatter to register. If not specified default {@link DateFormatter}
* Set the date formatter to register. If not specified
the
default {@link DateFormatter}
* will be used. This method can be used if additional formatter configuration is
* required.
* @param dateFormatter the date formatter
...
...
spring-context/src/main/java/org/springframework/format/datetime/DateTimeFormatAnnotationFormatterFactory.java
浏览文件 @
cef5f022
...
...
@@ -28,15 +28,15 @@ import org.springframework.format.Formatter;
import
org.springframework.format.Parser
;
import
org.springframework.format.Printer
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory
;
import
org.springframework.util.StringValueResolver
;
/**
* Formats fields annotated with the {@link DateTimeFormat} annotation.
* Formats fields annotated with the {@link DateTimeFormat} annotation using
* a {@link DateFormatter}.
*
* @author Phillip Webb
* @see JodaDateTimeFormatAnnotationFormatterFactory
* @since 3.2
* @see org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory
*/
public
class
DateTimeFormatAnnotationFormatterFactory
implements
AnnotationFormatterFactory
<
DateTimeFormat
>,
EmbeddedValueResolverAware
{
...
...
spring-context/src/main/java/org/springframework/format/datetime/joda/DateTimeFormatterFactory.java
浏览文件 @
cef5f022
...
...
@@ -22,13 +22,14 @@ import org.joda.time.DateTimeZone;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.joda.time.format.ISODateTimeFormat
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.format.annotation.DateTimeFormat.ISO
;
import
org.springframework.util.StringUtils
;
/**
* {@link FactoryBean} that creates a Joda {@link DateTimeFormatter}. Formatters will be
* created using the defined {@link #setPattern(String) pattern}, {@link #setIso(ISO) ISO}
* created using the defined {@link #setPattern(String) pattern}, {@link #setIso(ISO) ISO}
,
* or {@link #setStyle(String) style} (considered in that order).
*
* @author Phillip Webb
...
...
@@ -48,13 +49,13 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
/**
* Create a new {@
link
DateTimeFormatterFactory} instance.
* Create a new {@
code
DateTimeFormatterFactory} instance.
*/
public
DateTimeFormatterFactory
()
{
}
/**
* Create a new {@
link
DateTimeFormatterFactory} instance.
* Create a new {@
code
DateTimeFormatterFactory} instance.
* @param pattern the pattern to use to format date values
*/
public
DateTimeFormatterFactory
(
String
pattern
)
{
...
...
@@ -75,8 +76,8 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
}
/**
* Get a new
DateTimeFormatter
using this factory. If no specific
* {@link #setStyle(String) style}
{@link #setIso(ISO) ISO}
or
* Get a new
{@code DateTimeFormatter}
using this factory. If no specific
* {@link #setStyle(String) style}
, {@link #setIso(ISO) ISO},
or
* {@link #setPattern(String) pattern} have been defined the
* {@link DateTimeFormat#mediumDateTime() medium date time format} will be used.
* @return a new date time formatter
...
...
@@ -88,9 +89,9 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
}
/**
* Get a new
DateTimeFormatter
using this factory. If no specific
* {@link #setStyle(String) style}
{@link #setIso(ISO) ISO}
or
* {@link #setPattern(String) pattern} have been defined the s
pecific
* Get a new
{@code DateTimeFormatter}
using this factory. If no specific
* {@link #setStyle(String) style}
, {@link #setIso(ISO) ISO},
or
* {@link #setPattern(String) pattern} have been defined the s
upplied
* {@code fallbackFormatter} will be used.
* @param fallbackFormatter the fall-back formatter to use when no specific factory
* properties have been set (can be {@code null}).
...
...
@@ -125,7 +126,7 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
/**
* Set the
TimeZone
to normalize the date values into, if any.
* Set the
{@code TimeZone}
to normalize the date values into, if any.
* @param timeZone the time zone
*/
public
void
setTimeZone
(
TimeZone
timeZone
)
{
...
...
@@ -133,16 +134,16 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
}
/**
* Set the two character
to use to format date values. The first character
used for
* the date style
, the second is for the time style. Supported characters are
* Set the two character
s to use to format date values. The first character is
used for
* the date style
; the second is for the time style. Supported characters are:
* <ul>
* <li>'S' = Small</li>
* <li>'M' = Medium</li>
* <li>'L' = Long</li>
* <li>'F' = Full</li>
* <li>'-' = Omitted</li>
* <ul>
* This method mimics the styles supported by Joda Time.
* <
/
ul>
*
<p>
This method mimics the styles supported by Joda Time.
* @param style two characters from the set {"S", "M", "L", "F", "-"}
*/
public
void
setStyle
(
String
style
)
{
...
...
@@ -150,8 +151,8 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
}
/**
* Set the ISO format used
for this date
.
* @param iso the
iso
format
* Set the ISO format used
to format date values
.
* @param iso the
ISO
format
*/
public
void
setIso
(
ISO
iso
)
{
this
.
iso
=
iso
;
...
...
@@ -164,4 +165,5 @@ public class DateTimeFormatterFactory implements FactoryBean<DateTimeFormatter>
public
void
setPattern
(
String
pattern
)
{
this
.
pattern
=
pattern
;
}
}
spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java
浏览文件 @
cef5f022
...
...
@@ -29,6 +29,7 @@ import org.joda.time.LocalTime;
import
org.joda.time.ReadableInstant
;
import
org.joda.time.ReadablePartial
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.context.EmbeddedValueResolverAware
;
import
org.springframework.format.AnnotationFormatterFactory
;
import
org.springframework.format.Parser
;
...
...
spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java
浏览文件 @
cef5f022
...
...
@@ -27,15 +27,15 @@ import org.joda.time.LocalTime;
import
org.joda.time.ReadableInstant
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.format.FormatterRegistrar
;
import
org.springframework.format.FormatterRegistry
;
import
org.springframework.format.Parser
;
import
org.springframework.format.Printer
;
import
org.springframework.format.annotation.DateTimeFormat.ISO
;
import
org.springframework.format.datetime.DateFormatterRegistrar
;
/**
* Configures Joda Time's
F
ormatting system for use with Spring.
* Configures Joda Time's
f
ormatting system for use with Spring.
*
* @author Keith Donald
* @author Juergen Hoeller
...
...
@@ -46,7 +46,7 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
* @see #setDateTimeStyle
* @see #setUseIsoFormat
* @see FormatterRegistrar#registerFormatters
* @see DateFormatterRegistrar
* @see
org.springframework.format.datetime.
DateFormatterRegistrar
*/
public
class
JodaTimeFormatterRegistrar
implements
FormatterRegistrar
{
...
...
@@ -107,8 +107,8 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
/**
* Set the formatter that will be used for objects representing date values.
* This formatter will be used for the {@link LocalDate} type. When specified
* {@link #setDateStyle(String) dateStyle} and
*
<p>
This formatter will be used for the {@link LocalDate} type. When specified
*
the
{@link #setDateStyle(String) dateStyle} and
* {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored.
* @param formatter the formatter to use
* @see #setTimeFormatter(DateTimeFormatter)
...
...
@@ -120,9 +120,9 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
}
/**
* Set the formatter that will be used for objects representing
dat
e values.
* This formatter will be used for the {@link LocalTime} type. When specified
* {@link #setTimeStyle(String) timeStyle} and
* Set the formatter that will be used for objects representing
tim
e values.
*
<p>
This formatter will be used for the {@link LocalTime} type. When specified
*
the
{@link #setTimeStyle(String) timeStyle} and
* {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored.
* @param formatter the formatter to use
* @see #setDateFormatter(DateTimeFormatter)
...
...
@@ -135,9 +135,9 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
/**
* Set the formatter that will be used for objects representing date and time values.
* This formatter will be used for {@link LocalDateTime}, {@link ReadableInstant},
*
<p>
This formatter will be used for {@link LocalDateTime}, {@link ReadableInstant},
* {@link Date} and {@link Calendar} types. When specified
* {@link #setDateTimeStyle(String) dateTimeStyle} and
*
the
{@link #setDateTimeStyle(String) dateTimeStyle} and
* {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored.
* @param formatter the formatter to use
* @see #setDateFormatter(DateTimeFormatter)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录