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 EnhancedPropertyFormatter} must have a public no-argument constructor. A single instance
9    * will be created for each property; consequently, implementations must be thread safe.
10   *
11   * @since 2.0
12   * @see DefaultEnhancedPropertyFormatter
13   */
14  @SuppressWarnings("deprecation")
15  public interface EnhancedPropertyFormatter extends PropertyFormatter {
16    @Override // avoid deprecation warning
17    void initialize(AnnotatedElement element);
18  
19    /**
20     * Format an object; no attempt will be made to format it as an array.
21     * @param builder the builder to append the formatted representation of the object to
22     * @param o the object to format
23     */
24    void appendFormatted(StringBuilder builder, Object o);
25  
26    /**
27     * Format a boolean.
28     * @param builder the builder to append the formatted representation of the boolean to
29     * @param b the boolean to format
30     */
31    void appendFormatted(StringBuilder builder, boolean b);
32  
33    /**
34     * Format a byte
35     * @param builder the builder to append the formatted representation of the byte to
36     * @param b the byte to format
37     */
38    void appendFormatted(StringBuilder builder, byte b);
39  
40    /**
41     * Format a short
42     * @param builder the builder to append the formatted representation of the short to
43     * @param s the short to format
44     */
45    void appendFormatted(StringBuilder builder, short s);
46  
47    /**
48     * Format a character
49     * @param builder the builder to append the formatted representation of the character to
50     * @param c the character to format
51     */
52    void appendFormatted(StringBuilder builder, char c);
53  
54    /**
55     * Format an integer
56     * @param builder the builder to append the formatted representation of the integer to
57     * @param i the integer to format
58     */
59    void appendFormatted(StringBuilder builder, int i);
60  
61    /**
62     * Format a long
63     * @param builder the builder to append the formatted representation of the long to
64     * @param l the long to format
65     */
66    void appendFormatted(StringBuilder builder, long l);
67  
68    /**
69     * Format a float
70     * @param builder the builder to append the formatted representation of the float to
71     * @param f the float to format
72     */
73    void appendFormatted(StringBuilder builder, float f);
74  
75    /**
76     * Format a double
77     * @param builder the builder to append the formatted representation of the double to
78     * @param d the double to format
79     */
80    void appendFormatted(StringBuilder builder, double d);
81  
82    /**
83     * Format an array of booleans
84     * @param builder the builder to append the formatted representation of the array to
85     * @param booleans the array to format
86     */
87    void appendFormatted(StringBuilder builder, boolean[] booleans);
88  
89    /**
90     * Format an array of bytes
91     * @param builder the builder to append the formatted representation of the array to
92     * @param bytes the array to format
93     */
94    void appendFormatted(StringBuilder builder, byte[] bytes);
95  
96    /**
97     * Format an array of shorts
98     * @param builder the builder to append the formatted representation of the array to
99     * @param shorts the array to format
100    */
101   void appendFormatted(StringBuilder builder, short[] shorts);
102 
103   /**
104    * Format an array of characters
105    * @param builder the builder to append the formatted representation of the array to
106    * @param chars the array to format
107    */
108   void appendFormatted(StringBuilder builder, char[] chars);
109 
110   /**
111    * Format an array of integers
112    * @param builder the builder to append the formatted representation of the array to
113    * @param ints the array to format
114    */
115   void appendFormatted(StringBuilder builder, int[] ints);
116 
117   /**
118    * Format an array of longs
119    * @param builder the builder to append the formatted representation of the array to
120    * @param longs the array to format
121    */
122   void appendFormatted(StringBuilder builder, long[] longs);
123 
124   /**
125    * Format an array of floats
126    * @param builder the builder to append the formatted representation of the array to
127    * @param floats the array to format
128    */
129   void appendFormatted(StringBuilder builder, float[] floats);
130 
131   /**
132    * Format an array of doubles
133    * @param builder the builder to append the formatted representation of the array to
134    * @param doubles the array to format
135    */
136   void appendFormatted(StringBuilder builder, double[] doubles);
137 
138   /**
139    * Format an array of Objects
140    * @param builder the builder to append the formatted representation of the array to
141    * @param objects the array to format
142    */
143   void appendFormatted(StringBuilder builder, Object[] objects);
144 
145   /**
146    * Format an object, which may be an array.
147    * @param builder the builder to append the formatted representation of the object to
148    * @param o the object to format
149    */
150   void appendFormattedPossibleArray(StringBuilder builder, Object o);
151 }