public class DefaultValueStyler extends java.lang.Object implements ValueStyler
toString
styling conventions.
Uses the reflective visitor pattern underneath the hood to nicely encapsulate styling algorithms for each type of styled object.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ARRAY |
private static java.lang.String |
COLLECTION |
private static java.lang.String |
EMPTY |
private static java.lang.String |
LIST |
private static java.lang.String |
MAP |
private static java.lang.String |
NULL |
private static java.lang.String |
SET |
Constructor and Description |
---|
DefaultValueStyler() |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
getCollectionTypeString(java.util.Collection<?> value) |
private java.lang.String |
style(java.util.Collection<?> value) |
private java.lang.String |
style(java.util.Map.Entry<?,?> value) |
private <K,V> java.lang.String |
style(java.util.Map<K,V> value) |
java.lang.String |
style(java.lang.Object value)
Style the given value, returning a String representation.
|
private java.lang.String |
styleArray(java.lang.Object[] array) |
private static final java.lang.String EMPTY
private static final java.lang.String NULL
private static final java.lang.String COLLECTION
private static final java.lang.String SET
private static final java.lang.String LIST
private static final java.lang.String MAP
private static final java.lang.String ARRAY
public java.lang.String style(java.lang.Object value)
ValueStyler
style
in interface ValueStyler
value
- the Object value to styleprivate <K,V> java.lang.String style(java.util.Map<K,V> value)
private java.lang.String style(java.util.Map.Entry<?,?> value)
private java.lang.String style(java.util.Collection<?> value)
private java.lang.String getCollectionTypeString(java.util.Collection<?> value)
private java.lang.String styleArray(java.lang.Object[] array)