Spring AnnotationFormatterFactory

  • 类全路径: org.springframework.format.AnnotationFormatterFactory
  1. public interface AnnotationFormatterFactory<A extends Annotation> {
  2. /**
  3. * The types of fields that may be annotated with the &lt;A&gt; annotation.
  4. * 字段类型
  5. */
  6. Set<Class<?>> getFieldTypes();
  7. /**
  8. * Get the Printer to print the value of a field of {@code fieldType} annotated with
  9. * {@code annotation}.
  10. * <p>If the type T the printer accepts is not assignable to {@code fieldType}, a
  11. * coercion from {@code fieldType} to T will be attempted before the Printer is invoked.
  12. * 通过注解和字段类型获取输出接口
  13. * @param annotation the annotation instance
  14. * @param fieldType the type of field that was annotated
  15. * @return the printer
  16. */
  17. Printer<?> getPrinter(A annotation, Class<?> fieldType);
  18. /**
  19. * Get the Parser to parse a submitted value for a field of {@code fieldType}
  20. * annotated with {@code annotation}.
  21. * <p>If the object the parser returns is not assignable to {@code fieldType},
  22. * a coercion to {@code fieldType} will be attempted before the field is set.
  23. * 通过注解和字段类型获取解析接口
  24. * @param annotation the annotation instance
  25. * @param fieldType the type of field that was annotated
  26. * @return the parser
  27. */
  28. Parser<?> getParser(A annotation, Class<?> fieldType);
  29. }