63 Star 427 Fork 156

huifer/Code-Analysis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Spring-DefaultFormattingConversionService.md 1.53 KB
一键复制 编辑 原始数据 按行查看 历史

Spring DefaultFormattingConversionService

  • 类全路径: org.springframework.format.support.DefaultFormattingConversionService

  • DefaultFormattingConversionService 围绕javax.moneyorg.joda.time.LocalDate 开发

  • 有关format对象

    • CurrencyUnitFormatter
    • MonetaryAmountFormatter
    • Jsr354NumberFormatAnnotationFormatterFactory
  • 添加 jsr 354 中 金钱和时间的formatter对象

public static void addDefaultFormatters(FormatterRegistry formatterRegistry) {
   // Default handling of number values
   formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());

   // Default handling of monetary values
   if (jsr354Present) {
      // 添加  jsr 354 中时间和金钱的format
      formatterRegistry.addFormatter(new CurrencyUnitFormatter());
      formatterRegistry.addFormatter(new MonetaryAmountFormatter());
      formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory());
   }

   // Default handling of date-time values

   // just handling JSR-310 specific date and time types
   // 追加 format register
   new DateTimeFormatterRegistrar().registerFormatters(formatterRegistry);

   if (jodaTimePresent) {
      // handles Joda-specific types as well as Date, Calendar, Long
      new JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry);
   }
   else {
      // regular DateFormat-based Date, Calendar, Long converters
      new DateFormatterRegistrar().registerFormatters(formatterRegistry);
   }
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/pychfarm_admin/code-analysis.git
git@gitee.com:pychfarm_admin/code-analysis.git
pychfarm_admin
code-analysis
Code-Analysis
v0.0.15

搜索帮助