1 package org.pojomatic.formatter;
2
3 import org.pojomatic.PropertyElement;
4 import org.pojomatic.Pojomator;
5
6 /**
7 * A formatter to aid in creating a {@code String} representation of a POJO. A new instance will be
8 * created for each time that {@link Pojomator#doToString(Object)} is called.
9 *
10 * @deprecated Since 2.0. Use {@link EnhancedPojoFormatter} instead. Use of this interface typically requires creating additional
11 * StringBuidler instances.
12 */
13 @Deprecated
14 public interface PojoFormatter {
15
16 /**
17 * Get the {@code String} which should appear at the beginning of the result of
18 * {@code toString()}.
19 *
20 * @param pojoClass the class for which {@code toString()} is being called
21 * @return the prefix to appear at the beginning of the result of {@code toString()}
22 * @see Object#toString()
23 *
24 * @deprecated Use {@link EnhancedPojoFormatter#appendToStringPrefix(StringBuilder, Class)} instead
25 */
26 @Deprecated
27 String getToStringPrefix(Class<?> pojoClass);
28
29 /**
30 * Get the {@code String} which should appear at the end of the result of
31 * {@code toString()}.
32 * @param pojoClass the class for which {@code toString()} is being called
33 * @return the suffix to appear at the end of the result of {@code toString()}
34 * @see Object#toString()
35 *
36 * @deprecated Use {@link EnhancedPojoFormatter#appendToStringSuffix(StringBuilder, Class)} instead
37 */
38 @Deprecated
39 String getToStringSuffix(Class<?> pojoClass);
40
41 /**
42 * Get the {@code String} prefix for a given {@code PropertyElement}. This method will be called
43 * once for each property used in the result of {@code toString()}, in the order in which
44 * those properties will appear in that result, and before the call to
45 * {@link PropertyFormatter#format(Object)} for the property's value.
46 * @param property the property for which to generate a prefix
47 * @return the prefix for the given property
48 *
49 * @deprecated Use {@link EnhancedPojoFormatter#appendPropertyPrefix(StringBuilder, PropertyElement)}
50 */
51 @Deprecated
52 String getPropertyPrefix(PropertyElement property);
53
54 /**
55 * Get the {@code String} suffix for a given {@code PropertyElement}. This method will be called
56 * once after each call to {@link PropertyFormatter#format(Object)} for the property's value.
57 * @param property the property for which to generate a suffix
58 * @return the suffix for the given property
59 *
60 * @deprecated Use {@link EnhancedPojoFormatter#appendPropertySuffix(StringBuilder, PropertyElement)}
61 */
62 @Deprecated
63 String getPropertySuffix(PropertyElement property);
64 }