View Javadoc
1   package org.pojomatic.formatter;
2   
3   import java.lang.reflect.AnnotatedElement;
4   
5   /**
6    * A formatter for a property.
7    * <p>
8    * Any implementation of {@code PropertyFormatter} must have a public no-argument constructor.
9    *
10   * @deprecated Since 2.0. Implement {@link EnhancedPropertyFormatter} instead. This class is unaware of primitives,
11   * and does not leverage StringBuilder.
12   */
13  @Deprecated
14  public interface PropertyFormatter {
15    /**
16     * Initialize the formatter for use; this method will be called exactly once on an instance, prior
17     * to any calls to {@link #format(Object)}.  This method does not need to be thread-safe. A typical implementation
18     * might inspect the element for additional annotations used to configure the formatter.
19     * @param element the field or method this formatter will be used for.
20     */
21    public void initialize(AnnotatedElement element);
22  
23    /**
24     * Format a given value.  This method must be thread safe.
25     * @param value the value to format
26     * @return the value, formatted (must not be null)
27     */
28    public String format(Object value);
29  }