ToStringStyle
- @SuppressWarnings({"deprecation"}) public abstract class org.apache.commons.lang3.builder.ToStringStyle implements Serializable[source]
Controls
Stringformatting forToStringBuilder. The main public interface is always viaToStringBuilder.These classes are intended to be used as singletons. There is no need to instantiate a new style each time. A program will generally use one of the predefined constants on this class. Alternatively, the
StandardToStringStyleclass can be used to set the individual settings. Thus most styles can be achieved without subclassing.If required, a subclass can override as many or as few of the methods as it requires. Each object type (from
booleantolongtoObjecttoint[]) has its own methods to output it. Most have two versions, detail and summary.For example, the detail version of the array based methods will output the whole array, whereas the summary method will just output the array length.
If you want to format the output of certain objects, such as dates, you must create a subclass and override a method.
public class MyStyle extends ToStringStyle { protected void appendDetail(StringBuffer buffer, String fieldName, Object value) { if (value instanceof Date) { value = new SimpleDateFormat("yyyy-MM-dd").format(value); } buffer.append(value); } }
- Since:
1.0
Constructors
Constructs a new instance. |
Fields and constants
The default toString style. |
|
The JSON toString style. |
|
The multi line toString style. |
|
The no class name toString style. |
|
The no field names toString style. |
|
The short prefix toString style. |
|
The simple toString style. |
- public static final ToStringStyle DEFAULT_STYLE[source]
The default toString style. Using the
Personexample fromToStringBuilder, the output would look like this:Person@182f0db[name=John Doe,age=33,smoker=false]
- public static final ToStringStyle JSON_STYLE[source]
The JSON toString style. Using the
Personexample fromToStringBuilder, the output would look like this:{"name": "John Doe", "age": 33, "smoker": true}
Note: Since field names are mandatory in JSON, this ToStringStyle will throw an
UnsupportedOperationExceptionif no field name is passed in while appending. Furthermore This ToStringStyle will only generate valid JSON if referenced objects also produce JSON when callingtoString()on them.- Since:
3.4
- See also:
- public static final ToStringStyle MULTI_LINE_STYLE[source]
The multi line toString style. Using the
Personexample fromToStringBuilder, the output would look like this:Person@182f0db[ name=John Doe age=33 smoker=false ]
- public static final ToStringStyle NO_CLASS_NAME_STYLE[source]
The no class name toString style. Using the
Personexample fromToStringBuilder, the output would look like this:[name=John Doe,age=33,smoker=false]
- Since:
3.4
- public static final ToStringStyle NO_FIELD_NAMES_STYLE[source]
The no field names toString style. Using the
Personexample fromToStringBuilder, the output would look like this:Person@182f0db[John Doe,33,false]
- public static final ToStringStyle SHORT_PREFIX_STYLE[source]
The short prefix toString style. Using the
Personexample fromToStringBuilder, the output would look like this:Person[name=John Doe,age=33,smoker=false]
- Since:
2.1
- public static final ToStringStyle SIMPLE_STYLE[source]
The simple toString style. Using the
Personexample fromToStringBuilder, the output would look like this:John Doe,33,false
Methods
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Appends to the |
|
Gets the array end text. |
|
Gets the array separator text. |
|
Gets the array start text. |
|
Gets the content end text. |
|
Gets the content start text. |
|
Gets the field name value separator text. |
|
Gets the field separator text. |
|
Gets the text to output when |
|
Gets the registry of objects being traversed by the |
|
Gets the short class name for a class. |
|
Gets the end text to output when a |
|
Gets the start text to output when a |
|
Gets the end text to output when an |
|
Gets the start text to output when an |
|
Tests whether to output array content detail. |
|
Tests whether full detail is used when the caller does not specify a detail level. |
|
Tests whether the field separator should be added at the end of each buffer. |
|
Tests whether the field separator should be added at the start of each buffer. |
|
Tests whether this field should be output in full detail. |
|
Tests whether to use the class name. |
|
Tests whether to use the field names passed in. |
|
Tests whether to use the identity hash code. |
|
Tests whether short class names should be output. |
|
Appends to the |
|
Remove the last field separator from the buffer. |
|
Sets whether to output array content detail. |
|
Sets the array end text. |
|
Sets the array separator text. |
|
Sets the array start text. |
|
Sets the content end text. |
|
Sets the content start text. |
|
Sets whether to use full detail when the caller doesn’t specify. |
|
Sets the field name value separator text. |
|
Sets the field separator text. |
|
Sets whether the field separator should be added at the end of each buffer. |
|
Sets whether the field separator should be added at the start of each buffer. |
|
Sets the text to output when |
|
Sets the end text to output when a |
|
Sets the start text to output when a |
|
Sets the end text to output when an |
|
Sets the start text to output when an |
|
Sets whether to use the class name. |
|
Sets whether to use the field names passed in. |
|
Sets whether to use the identity hash code. |
|
Sets whether to output short or long class names. |
- public void append(StringBuffer buffer, String fieldName, boolean value)[source]
Appends to the
toStringabooleanvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, boolean[] array, Boolean fullDetail)[source]
Appends to the
toStringabooleanarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the toString.
fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, byte value)[source]
Appends to the
toStringabytevalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, byte[] array, Boolean fullDetail)[source]
Appends to the
toStringabytearray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the
toString.fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, char value)[source]
Appends to the
toStringacharvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, char[] array, Boolean fullDetail)[source]
Appends to the
toStringachararray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the
toString.fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, double value)[source]
Appends to the
toStringadoublevalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, double[] array, Boolean fullDetail)[source]
Appends to the
toStringadoublearray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the toString.
fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, float value)[source]
Appends to the
toStringafloatvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, float[] array, Boolean fullDetail)[source]
Appends to the
toStringafloatarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the toString.
fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, int value)[source]
Appends to the
toStringanintvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, int[] array, Boolean fullDetail)[source]
Appends to the
toStringanintarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the
toString.fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, Object value, Boolean fullDetail)[source]
Appends to the
toStringanObjectvalue, printing the fulltoStringof theObjectpassed in.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, Object[] array, Boolean fullDetail)[source]
Appends to the
toStringanObjectarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the toString.
fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, long value)[source]
Appends to the
toStringalongvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, long[] array, Boolean fullDetail)[source]
Appends to the
toStringalongarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the
toString.fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- public void append(StringBuffer buffer, String fieldName, short value)[source]
Appends to the
toStringashortvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
value – The value to add to the
toString.
- public void append(StringBuffer buffer, String fieldName, short[] array, Boolean fullDetail)[source]
Appends to the
toStringashortarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
array – The array to add to the
toString.fullDetail –
truefor detail,falsefor summary info,nullfor style decides.
- protected void appendClassName(StringBuffer buffer, Object object)[source]
Appends to the
toStringthe class name.- Parameters:
buffer – The
StringBufferto populate.object – The
Objectwhose name to output.
- protected void appendContentEnd(StringBuffer buffer)[source]
Appends to the
toStringthe content end.- Parameters:
buffer – The
StringBufferto populate.
- protected void appendContentStart(StringBuffer buffer)[source]
Appends to the
toStringthe content start.- Parameters:
buffer – The
StringBufferto populate.
- protected void appendCyclicObject(StringBuffer buffer, String fieldName, Object value)[source]
Appends to the
toStringanObjectvalue that has been detected to participate in a cycle. This implementation will print the standard string value of the value.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended
value – The value to add to the
toString, notnull.
- Since:
2.2
- protected void appendDetail(StringBuffer buffer, String fieldName, boolean value)[source]
Appends to the
toStringabooleanvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, boolean[] array)[source]
Appends to the
toStringthe detail of abooleanarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, byte value)[source]
Appends to the
toStringabytevalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, byte[] array)[source]
Appends to the
toStringthe detail of abytearray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, char value)[source]
Appends to the
toStringacharvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, char[] array)[source]
Appends to the
toStringthe detail of achararray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, double value)[source]
Appends to the
toStringadoublevalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, double[] array)[source]
Appends to the
toStringthe detail of adoublearray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, float value)[source]
Appends to the
toStringafloatvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, float[] array)[source]
Appends to the
toStringthe detail of afloatarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, int value)[source]
Appends to the
toStringanintvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, int i, Object item)[source]
Appends to the
toStringthe detail of anObjectarray item.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
i – The array item index to add.
item – The array item to add.
- Since:
3.11
- protected void appendDetail(StringBuffer buffer, String fieldName, int[] array)[source]
Appends to the
toStringthe detail of anintarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, Object value)[source]
Appends to the
toStringanObjectvalue, printing the full detail of theObject.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, Object[] array)[source]
Appends to the
toStringthe detail of anObjectarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, Collection<?> coll)[source]
Appends to the
toStringaCollection.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
coll – The
Collectionto add to thetoString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, Map<?, ?> map)[source]
Appends to the
toStringaMap.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
map – The
Mapto add to thetoString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, long value)[source]
Appends to the
toStringalongvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, long[] array)[source]
Appends to the
toStringthe detail of alongarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendDetail(StringBuffer buffer, String fieldName, short value)[source]
Appends to the
toStringashortvalue.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString.
- protected void appendDetail(StringBuffer buffer, String fieldName, short[] array)[source]
Appends to the
toStringthe detail of ashortarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- public void appendEnd(StringBuffer buffer, Object object)[source]
Appends to the
toStringthe end of data indicator.- Parameters:
buffer – The
StringBufferto populate.object – The
Objectto build atoStringfor.
- protected void appendFieldEnd(StringBuffer buffer, String fieldName)[source]
Appends to the
toStringthe field end.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
- protected void appendFieldSeparator(StringBuffer buffer)[source]
Appends to the
toStringthe field separator.- Parameters:
buffer – The
StringBufferto populate.
- protected void appendFieldStart(StringBuffer buffer, String fieldName)[source]
Appends to the
toStringthe field start.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name.
- protected void appendIdentityHashCode(StringBuffer buffer, Object object)[source]
Appends the
System#identityHashCode(java.lang.Object).- Parameters:
buffer – The
StringBufferto populate.object – The
Objectwhose id to output.
- protected void appendInternal(StringBuffer buffer, String fieldName, Object value, boolean detail)[source]
Appends to the
toStringanObject, correctly interpreting its type.This method performs the main lookup by Class type to correctly route arrays,
Collections,Maps andObjectsto the appropriate method.Either detail or summary views can be specified.
If a cycle is detected, an object will be appended with the
Object.toString()format.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString, notnull.detail – output detail or not.
- protected void appendNullText(StringBuffer buffer, String fieldName)[source]
Appends to the
toStringan indicator fornull.The default indicator is
"<null>".- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
- public void appendStart(StringBuffer buffer, Object object)[source]
Appends to the
toStringthe start of data indicator.- Parameters:
buffer – The
StringBufferto populate.object – The
Objectto build atoStringfor.
- protected void appendSummary(StringBuffer buffer, String fieldName, boolean[] array)[source]
Appends to the
toStringa summary of abooleanarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, byte[] array)[source]
Appends to the
toStringa summary of abytearray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, char[] array)[source]
Appends to the
toStringa summary of achararray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, double[] array)[source]
Appends to the
toStringa summary of adoublearray.- Parameters:
buffer – The
StringBufferto populatefieldName – The field name, typically not used as already appended
array – The array to add to the
toString, notnull
- protected void appendSummary(StringBuffer buffer, String fieldName, float[] array)[source]
Appends to the
toStringa summary of afloatarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, int[] array)[source]
Appends to the
toStringa summary of anintarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, Object value)[source]
Appends to the
toStringanObjectvalue, printing a summary of theObject.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
value – The value to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, Object[] array)[source]
Appends to the
toStringa summary of anObjectarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, long[] array)[source]
Appends to the
toStringa summary of alongarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummary(StringBuffer buffer, String fieldName, short[] array)[source]
Appends to the
toStringa summary of ashortarray.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- protected void appendSummarySize(StringBuffer buffer, String fieldName, int size)[source]
Appends to the
toStringa size summary.The size summary is used to summarize the contents of
Collections,Maps and arrays.The output consists of a prefix, the passed in size and a suffix.
The default format is
"<size=n>".- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
size – The size to append.
- public void appendSuper(StringBuffer buffer, String superToString)[source]
Appends to the
toStringthe superclass toString.NOTE: It assumes that the toString has been created from the same ToStringStyle.
A
nullsuperToStringis ignored.- Parameters:
buffer – The
StringBufferto populate.superToString – The
super.toString().
- Since:
2.0
- public void appendToString(StringBuffer buffer, String toString)[source]
Appends to the
toStringanother toString.NOTE: It assumes that the toString has been created from the same ToStringStyle.
A
nulltoStringis ignored.- Parameters:
buffer – The
StringBufferto populate.toString – The additional
toString.
- Since:
2.0
- protected String getArrayEnd()[source]
Gets the array end text.
- Returns:
The current array end text.
- protected String getArraySeparator()[source]
Gets the array separator text.
- Returns:
The current array separator text.
- protected String getArrayStart()[source]
Gets the array start text.
- Returns:
The current array start text.
- protected String getContentEnd()[source]
Gets the content end text.
- Returns:
The current content end text.
- protected String getContentStart()[source]
Gets the content start text.
- Returns:
The current content start text.
- protected String getFieldNameValueSeparator()[source]
Gets the field name value separator text.
- Returns:
The current field name value separator text.
- protected String getFieldSeparator()[source]
Gets the field separator text.
- Returns:
The current field separator text.
- protected String getNullText()[source]
Gets the text to output when
nullfound.- Returns:
The current text to output when null found.
- public static Map<Object, Object> getRegistry()[source]
Gets the registry of objects being traversed by the
reflectionToStringmethods in the current thread.- Returns:
Set the registry of objects being traversed.
- protected String getShortClassName(Class<?> cls)[source]
Gets the short class name for a class.
The short class name is the class name excluding the package name.
- Parameters:
cls – The
Classto get the short name of.- Returns:
The short name.
- protected String getSizeEndText()[source]
Gets the end text to output when a
Collection,Mapor array size is output.This is output after the size value.
- Returns:
The current end of size text.
- protected String getSizeStartText()[source]
Gets the start text to output when a
Collection,Mapor array size is output.This is output before the size value.
- Returns:
The current start of size text.
- protected String getSummaryObjectEndText()[source]
Gets the end text to output when an
Objectis output in summary mode.This is output after the size value.
- Returns:
The current end of summary text.
- protected String getSummaryObjectStartText()[source]
Gets the start text to output when an
Objectis output in summary mode.This is output before the size value.
- Returns:
The current start of summary text.
- protected boolean isArrayContentDetail()[source]
Tests whether to output array content detail.
- Returns:
The current array content detail setting.
- protected boolean isDefaultFullDetail()[source]
Tests whether full detail is used when the caller does not specify a detail level.
- Returns:
The current defaultFullDetail flag.
- protected boolean isFieldSeparatorAtEnd()[source]
Tests whether the field separator should be added at the end of each buffer.
- Returns:
fieldSeparatorAtEnd flag.
- Since:
2.0
- protected boolean isFieldSeparatorAtStart()[source]
Tests whether the field separator should be added at the start of each buffer.
- Returns:
The fieldSeparatorAtStart flag.
- Since:
2.0
- protected boolean isFullDetail(Boolean fullDetailRequest)[source]
Tests whether this field should be output in full detail.
This method converts a detail request into a detail level. The calling code may request full detail (
true), but a subclass might ignore that and always returnfalse. The calling code may pass innullindicating that it doesn’t care about the detail level. In this case the default detail level is used.- Parameters:
fullDetailRequest – The detail level requested.
- Returns:
whether full detail is to be shown.
- protected boolean isUseClassName()[source]
Tests whether to use the class name.
- Returns:
The current useClassName flag.
- protected boolean isUseFieldNames()[source]
Tests whether to use the field names passed in.
- Returns:
The current useFieldNames flag.
- protected boolean isUseIdentityHashCode()[source]
Tests whether to use the identity hash code.
- Returns:
The current useIdentityHashCode flag.
- protected boolean isUseShortClassName()[source]
Tests whether short class names should be output.
- Returns:
The current useShortClassName flag.
- Since:
2.0
- protected void reflectionAppendArrayDetail(StringBuffer buffer, String fieldName, Object array)[source]
Appends to the
toStringthe detail of an array type.- Parameters:
buffer – The
StringBufferto populate.fieldName – The field name, typically not used as already appended.
array – The array to add to the
toString, notnull.
- Since:
2.0
- protected void removeLastFieldSeparator(StringBuffer buffer)[source]
Remove the last field separator from the buffer.
- Parameters:
buffer – The
StringBufferto populate.- Since:
2.0
- protected void setArrayContentDetail(boolean arrayContentDetail)[source]
Sets whether to output array content detail.
- Parameters:
arrayContentDetail – The new arrayContentDetail flag.
- protected void setArrayEnd(String arrayEnd)[source]
Sets the array end text.
nullis accepted, but will be converted to an empty String.- Parameters:
arrayEnd – The new array end text.
- protected void setArraySeparator(String arraySeparator)[source]
Sets the array separator text.
nullis accepted, but will be converted to an empty String.- Parameters:
arraySeparator – The new array separator text.
- protected void setArrayStart(String arrayStart)[source]
Sets the array start text.
nullis accepted, but will be converted to an empty String.- Parameters:
arrayStart – The new array start text.
- protected void setContentEnd(String contentEnd)[source]
Sets the content end text.
nullis accepted, but will be converted to an empty String.- Parameters:
contentEnd – The new content end text.
- protected void setContentStart(String contentStart)[source]
Sets the content start text.
nullis accepted, but will be converted to an empty String.- Parameters:
contentStart – The new content start text.
- protected void setDefaultFullDetail(boolean defaultFullDetail)[source]
Sets whether to use full detail when the caller doesn’t specify.
- Parameters:
defaultFullDetail – The new defaultFullDetail flag.
- protected void setFieldNameValueSeparator(String fieldNameValueSeparator)[source]
Sets the field name value separator text.
nullis accepted, but will be converted to an empty String.- Parameters:
fieldNameValueSeparator – The new field name value separator text.
- protected void setFieldSeparator(String fieldSeparator)[source]
Sets the field separator text.
nullis accepted, but will be converted to an empty String.- Parameters:
fieldSeparator – The new field separator text.
- protected void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)[source]
Sets whether the field separator should be added at the end of each buffer.
- Parameters:
fieldSeparatorAtEnd – The fieldSeparatorAtEnd flag.
- Since:
2.0
- protected void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)[source]
Sets whether the field separator should be added at the start of each buffer.
- Parameters:
fieldSeparatorAtStart – The fieldSeparatorAtStart flag.
- Since:
2.0
- protected void setNullText(String nullText)[source]
Sets the text to output when
nullfound.nullis accepted, but will be converted to an empty String.- Parameters:
nullText – The new text to output when null found.
- protected void setSizeEndText(String sizeEndText)[source]
Sets the end text to output when a
Collection,Mapor array size is output.This is output after the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
sizeEndText – The new end of size text.
- protected void setSizeStartText(String sizeStartText)[source]
Sets the start text to output when a
Collection,Mapor array size is output.This is output before the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
sizeStartText – The new start of size text.
- protected void setSummaryObjectEndText(String summaryObjectEndText)[source]
Sets the end text to output when an
Objectis output in summary mode.This is output after the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
summaryObjectEndText – The new end of summary text.
- protected void setSummaryObjectStartText(String summaryObjectStartText)[source]
Sets the start text to output when an
Objectis output in summary mode.This is output before the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
summaryObjectStartText – The new start of summary text.
- protected void setUseClassName(boolean useClassName)[source]
Sets whether to use the class name.
- Parameters:
useClassName – The new useClassName flag.
- protected void setUseFieldNames(boolean useFieldNames)[source]
Sets whether to use the field names passed in.
- Parameters:
useFieldNames – The new useFieldNames flag.