<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Format on 知识铺的博客</title>
    <link>https://index.zshipu.com/geek/tags/format/</link>
    <description>Recent content in Format on 知识铺的博客</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-CN</language>
    <lastBuildDate>Wed, 06 Mar 2024 13:23:00 +0000</lastBuildDate>
    <atom:link href="https://index.zshipu.com/geek/tags/format/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Spring-Printer</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-Printer/</link>
      <pubDate>Wed, 06 Mar 2024 13:23:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-Printer/</guid>
      <description>Spring Printer 类全路径: org.springframework.format.Printer 类作用: 对象转换成字符串 1 2 3 4 5 6 7 8 9 10 11 12 13 @FunctionalInterface public interface Printer&amp;lt;T&amp;gt; { /** * Print the object of type T for display. * 打印对象 * @param object the instance to print * @param locale the current user locale * @return the printed text string */ String print(T object, Locale locale); }</description>
    </item>
    <item>
      <title>Spring-Parser</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-Parser/</link>
      <pubDate>Wed, 06 Mar 2024 13:22:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-Parser/</guid>
      <description>Spring Parser 类全路径: org.springframework.format.Parser 类作用: 字符串准换成 java 对象 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 @FunctionalInterface public interface Parser&amp;lt;T&amp;gt; { /** * Parse a text String to produce a T. * 将字符串转换成对象 * @param text the text string * @param locale the current user locale * @return an instance of T * @throws ParseException when a parse exception occurs in a java.text parsing library * @throws IllegalArgumentException when a parse exception occurs */ T parse(String text, Locale locale) throws ParseException; } 类图</description>
    </item>
    <item>
      <title>Spring-Formatter</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-Formatter/</link>
      <pubDate>Wed, 06 Mar 2024 13:21:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-Formatter/</guid>
      <description>Spring Formatter 类全路径: org.springframework.format.Formatter 1 2 3 public interface Formatter&amp;lt;T&amp;gt; extends Printer&amp;lt;T&amp;gt;, Parser&amp;lt;T&amp;gt; { } 该接口继承了 printer 和 parser 两个接口. 比较常见的有: DateFormatter 就是继承这个接口.</description>
    </item>
    <item>
      <title>Spring-AnnotationFormatterFactory</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-AnnotationFormatterFactory/</link>
      <pubDate>Wed, 06 Mar 2024 13:20:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Spring-AnnotationFormatterFactory/</guid>
      <description>Spring AnnotationFormatterFactory 类全路径: org.springframework.format.AnnotationFormatterFactory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 public interface AnnotationFormatterFactory&amp;lt;A extends Annotation&amp;gt; { /** * The types of fields that may be annotated with the &amp;amp;lt;A&amp;amp;gt; annotation. * 字段类型 */ Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; getFieldTypes(); /** * Get the Printer to print the value of a field of {@code fieldType} annotated with * {@code annotation}. * &amp;lt;p&amp;gt;If the type T the printer accepts is not assignable to {@code fieldType}, a * coercion from {@code fieldType} to T will be attempted before the Printer is invoked. * 通过注解和字段类型获取输出接口 * @param annotation the</description>
    </item>
    <item>
      <title>Spring-MillisecondInstantPrinter</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Printer/Spring-MillisecondInstantPrinter/</link>
      <pubDate>Wed, 06 Mar 2024 13:19:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Printer/Spring-MillisecondInstantPrinter/</guid>
      <description>Spring MillisecondInstantPrinter 类全路径: org.springframework.format.datetime.joda.MillisecondInstantPrinter 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 public final class MillisecondInstantPrinter implements Printer&amp;lt;Long&amp;gt; { private final DateTimeFormatter formatter; /** * Create a new ReadableInstantPrinter. * @param formatter the Joda DateTimeFormatter instance */ public MillisecondInstantPrinter(DateTimeFormatter formatter) { this.formatter = formatter; } @Override public String print(Long instant, Locale locale) { // DateTimeFormatter .print return JodaTimeContextHolder.getFormatter(this.formatter, locale).print(instant); } }</description>
    </item>
    <item>
      <title>Spring-DateTimeParser</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Parser/Spring-DateTimeParser/</link>
      <pubDate>Wed, 06 Mar 2024 13:18:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/Parser/Spring-DateTimeParser/</guid>
      <description>Spring DateTimeParser 类全路径: org.springframework.format.datetime.joda.DateTimeParser 代码如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 public final class DateTimeParser implements Parser&amp;lt;DateTime&amp;gt; { private final DateTimeFormatter formatter; /** * Create a new DateTimeParser. * @param formatter the Joda DateTimeFormatter instance */ public DateTimeParser(DateTimeFormatter formatter) { this.formatter = formatter; } @Override public DateTime parse(String text, Locale locale) throws ParseException { // DateTimeFormatter 转换字符串事件类型 return JodaTimeContextHolder.getFormatter(this.formatter, locale).parseDateTime(text); } }</description>
    </item>
    <item>
      <title>Spring-DateTimeFormatAnnotationFormatterFactory</title>
      <link>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/AnnotationFormatterFactory/Spring-DateTimeFormatAnnotationFormatterFactory/</link>
      <pubDate>Wed, 06 Mar 2024 13:17:00 +0000</pubDate>
      <guid>https://index.zshipu.com/geek/post/code/docs/Spring/clazz/format/AnnotationFormatterFactory/Spring-DateTimeFormatAnnotationFormatterFactory/</guid>
      <description>Spring DateTimeFormatAnnotationFormatterFactory 类全路径: org.springframework.format.datetime.DateTimeFormatAnnotationFormatterFactory 类图 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 public class DateTimeFormatAnnotationFormatterFactory extends EmbeddedValueResolutionSupport implements AnnotationFormatterFactory&amp;lt;DateTimeFormat&amp;gt; { /** * 字段类型 */ private static final Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; FIELD_TYPES; @Override public Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; getFieldTypes() { return FIELD_TYPES; } @Override public Printer&amp;lt;?&amp;gt; getPrinter(DateTimeFormat annotation, Class&amp;lt;?&amp;gt; fieldType) { return getFormatter(annotation, fieldType); } @Override public Parser&amp;lt;?&amp;gt; getParser(DateTimeFormat annotation, Class&amp;lt;?&amp;gt; fieldType) { return getFormatter(annotation, fieldType); } protected Formatter&amp;lt;Date&amp;gt; getFormatter(DateTimeFormat annotation, Class&amp;lt;?&amp;gt; fieldType) { DateFormatter formatter = new DateFormatter(); // style String style = resolveEmbeddedValue(annotation.style()); // 判断时间格式是</description>
    </item>
  </channel>
</rss>
