Class ToStringStyle
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- RecursiveToStringStyle,- StandardToStringStyle
String formatting for ToStringBuilder.
 The main public interface is always via ToStringBuilder.
 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 StandardToStringStyle class 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 boolean
 to long to Object to int[]) 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
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ToStringStyleThe default toString style.static final ToStringStyleThe JSON toString style.static final ToStringStyleThe multi line toString style.static final ToStringStyleThe no class name toString style.static final ToStringStyleThe no field names toString style.static final ToStringStyleThe short prefix toString style.static final ToStringStyleThe simple toString style.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidappend(StringBuffer buffer, String fieldName, boolean value) Appends to thetoStringabooleanvalue.voidappend(StringBuffer buffer, String fieldName, boolean[] array, Boolean fullDetail) Appends to thetoStringabooleanarray.voidappend(StringBuffer buffer, String fieldName, byte value) Appends to thetoStringabytevalue.voidappend(StringBuffer buffer, String fieldName, byte[] array, Boolean fullDetail) Appends to thetoStringabytearray.voidappend(StringBuffer buffer, String fieldName, char value) Appends to thetoStringacharvalue.voidappend(StringBuffer buffer, String fieldName, char[] array, Boolean fullDetail) Appends to thetoStringachararray.voidappend(StringBuffer buffer, String fieldName, double value) Appends to thetoStringadoublevalue.voidappend(StringBuffer buffer, String fieldName, double[] array, Boolean fullDetail) Appends to thetoStringadoublearray.voidappend(StringBuffer buffer, String fieldName, float value) Appends to thetoStringafloatvalue.voidappend(StringBuffer buffer, String fieldName, float[] array, Boolean fullDetail) Appends to thetoStringafloatarray.voidappend(StringBuffer buffer, String fieldName, int value) Appends to thetoStringanintvalue.voidappend(StringBuffer buffer, String fieldName, int[] array, Boolean fullDetail) Appends to thetoStringanintarray.voidappend(StringBuffer buffer, String fieldName, long value) Appends to thetoStringalongvalue.voidappend(StringBuffer buffer, String fieldName, long[] array, Boolean fullDetail) Appends to thetoStringalongarray.voidappend(StringBuffer buffer, String fieldName, short value) Appends to thetoStringashortvalue.voidappend(StringBuffer buffer, String fieldName, short[] array, Boolean fullDetail) Appends to thetoStringashortarray.voidappend(StringBuffer buffer, String fieldName, Object[] array, Boolean fullDetail) Appends to thetoStringanObjectarray.voidappend(StringBuffer buffer, String fieldName, Object value, Boolean fullDetail) protected voidappendClassName(StringBuffer buffer, Object object) Appends to thetoStringthe class name.protected voidappendContentEnd(StringBuffer buffer) Appends to thetoStringthe content end.protected voidappendContentStart(StringBuffer buffer) Appends to thetoStringthe content start.protected voidappendCyclicObject(StringBuffer buffer, String fieldName, Object value) Appends to thetoStringanObjectvalue that has been detected to participate in a cycle.protected voidappendDetail(StringBuffer buffer, String fieldName, boolean value) Appends to thetoStringabooleanvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, boolean[] array) Appends to thetoStringthe detail of abooleanarray.protected voidappendDetail(StringBuffer buffer, String fieldName, byte value) Appends to thetoStringabytevalue.protected voidappendDetail(StringBuffer buffer, String fieldName, byte[] array) Appends to thetoStringthe detail of abytearray.protected voidappendDetail(StringBuffer buffer, String fieldName, char value) Appends to thetoStringacharvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, char[] array) Appends to thetoStringthe detail of achararray.protected voidappendDetail(StringBuffer buffer, String fieldName, double value) Appends to thetoStringadoublevalue.protected voidappendDetail(StringBuffer buffer, String fieldName, double[] array) Appends to thetoStringthe detail of adoublearray.protected voidappendDetail(StringBuffer buffer, String fieldName, float value) Appends to thetoStringafloatvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, float[] array) Appends to thetoStringthe detail of afloatarray.protected voidappendDetail(StringBuffer buffer, String fieldName, int value) Appends to thetoStringanintvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, int[] array) Appends to thetoStringthe detail of anintarray.protected voidappendDetail(StringBuffer buffer, String fieldName, int i, Object item) Appends to thetoStringthe detail of anObjectarray item.protected voidappendDetail(StringBuffer buffer, String fieldName, long value) Appends to thetoStringalongvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, long[] array) Appends to thetoStringthe detail of alongarray.protected voidappendDetail(StringBuffer buffer, String fieldName, short value) Appends to thetoStringashortvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, short[] array) Appends to thetoStringthe detail of ashortarray.protected voidappendDetail(StringBuffer buffer, String fieldName, Object value) protected voidappendDetail(StringBuffer buffer, String fieldName, Object[] array) Appends to thetoStringthe detail of anObjectarray.protected voidappendDetail(StringBuffer buffer, String fieldName, Collection<?> coll) Appends to thetoStringaCollection.protected voidappendDetail(StringBuffer buffer, String fieldName, Map<?, ?> map) Appends to thetoStringaMap.voidappendEnd(StringBuffer buffer, Object object) Appends to thetoStringthe end of data indicator.protected voidappendFieldEnd(StringBuffer buffer, String fieldName) Appends to thetoStringthe field end.protected voidappendFieldSeparator(StringBuffer buffer) Appends to thetoStringthe field separator.protected voidappendFieldStart(StringBuffer buffer, String fieldName) Appends to thetoStringthe field start.protected voidappendIdentityHashCode(StringBuffer buffer, Object object) Appends theSystem.identityHashCode(java.lang.Object).protected voidappendInternal(StringBuffer buffer, String fieldName, Object value, boolean detail) Appends to thetoStringanObject, correctly interpreting its type.protected voidappendNullText(StringBuffer buffer, String fieldName) Appends to thetoStringan indicator fornull.voidappendStart(StringBuffer buffer, Object object) Appends to thetoStringthe start of data indicator.protected voidappendSummary(StringBuffer buffer, String fieldName, boolean[] array) Appends to thetoStringa summary of abooleanarray.protected voidappendSummary(StringBuffer buffer, String fieldName, byte[] array) Appends to thetoStringa summary of abytearray.protected voidappendSummary(StringBuffer buffer, String fieldName, char[] array) Appends to thetoStringa summary of achararray.protected voidappendSummary(StringBuffer buffer, String fieldName, double[] array) Appends to thetoStringa summary of adoublearray.protected voidappendSummary(StringBuffer buffer, String fieldName, float[] array) Appends to thetoStringa summary of afloatarray.protected voidappendSummary(StringBuffer buffer, String fieldName, int[] array) Appends to thetoStringa summary of anintarray.protected voidappendSummary(StringBuffer buffer, String fieldName, long[] array) Appends to thetoStringa summary of alongarray.protected voidappendSummary(StringBuffer buffer, String fieldName, short[] array) Appends to thetoStringa summary of ashortarray.protected voidappendSummary(StringBuffer buffer, String fieldName, Object value) protected voidappendSummary(StringBuffer buffer, String fieldName, Object[] array) Appends to thetoStringa summary of anObjectarray.protected voidappendSummarySize(StringBuffer buffer, String fieldName, int size) Appends to thetoStringa size summary.voidappendSuper(StringBuffer buffer, String superToString) Appends to thetoStringthe superclass toString.voidappendToString(StringBuffer buffer, String toString) Appends to thetoStringanother toString.protected StringGets the array end text.protected StringGets the array separator text.protected StringGets the array start text.protected StringGets the content end text.protected StringGets the content start text.protected StringGets the field name value separator text.protected StringGets the field separator text.protected StringGets the text to output whennullfound.Returns the registry of objects being traversed by thereflectionToStringmethods in the current thread.protected StringgetShortClassName(Class<?> cls) Gets the short class name for a class.protected StringGets the end text to output when aCollection,Mapor array size is output.protected StringGets the start text to output when aCollection,Mapor array size is output.protected StringGets the end text to output when anObjectis output in summary mode.protected StringGets the start text to output when anObjectis output in summary mode.protected booleanGets whether to output array content detail.protected booleanGets whether to use full detail when the caller doesn't specify.protected booleanGets whether the field separator should be added at the end of each buffer.protected booleanGets whether the field separator should be added at the start of each buffer.protected booleanisFullDetail(Boolean fullDetailRequest) Is this field to be output in full detail.protected booleanGets whether to use the class name.protected booleanGets whether to use the field names passed in.protected booleanGets whether to use the identity hash code.protected booleanGets whether to output short or long class names.protected voidreflectionAppendArrayDetail(StringBuffer buffer, String fieldName, Object array) Appends to thetoStringthe detail of an array type.protected voidremoveLastFieldSeparator(StringBuffer buffer) Remove the last field separator from the buffer.protected voidsetArrayContentDetail(boolean arrayContentDetail) Sets whether to output array content detail.protected voidsetArrayEnd(String arrayEnd) Sets the array end text.protected voidsetArraySeparator(String arraySeparator) Sets the array separator text.protected voidsetArrayStart(String arrayStart) Sets the array start text.protected voidsetContentEnd(String contentEnd) Sets the content end text.protected voidsetContentStart(String contentStart) Sets the content start text.protected voidsetDefaultFullDetail(boolean defaultFullDetail) Sets whether to use full detail when the caller doesn't specify.protected voidsetFieldNameValueSeparator(String fieldNameValueSeparator) Sets the field name value separator text.protected voidsetFieldSeparator(String fieldSeparator) Sets the field separator text.protected voidsetFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) Sets whether the field separator should be added at the end of each buffer.protected voidsetFieldSeparatorAtStart(boolean fieldSeparatorAtStart) Sets whether the field separator should be added at the start of each buffer.protected voidsetNullText(String nullText) Sets the text to output whennullfound.protected voidsetSizeEndText(String sizeEndText) Sets the end text to output when aCollection,Mapor array size is output.protected voidsetSizeStartText(String sizeStartText) Sets the start text to output when aCollection,Mapor array size is output.protected voidsetSummaryObjectEndText(String summaryObjectEndText) Sets the end text to output when anObjectis output in summary mode.protected voidsetSummaryObjectStartText(String summaryObjectStartText) Sets the start text to output when anObjectis output in summary mode.protected voidsetUseClassName(boolean useClassName) Sets whether to use the class name.protected voidsetUseFieldNames(boolean useFieldNames) Sets whether to use the field names passed in.protected voidsetUseIdentityHashCode(boolean useIdentityHashCode) Sets whether to use the identity hash code.protected voidsetUseShortClassName(boolean useShortClassName) Sets whether to output short or long class names.
- 
Field Details- 
DEFAULT_STYLEThe default toString style. Using thePersonexample fromToStringBuilder, the output would look like this:Person@182f0db[name=John Doe,age=33,smoker=false] 
- 
MULTI_LINE_STYLEThe multi line toString style. Using thePersonexample fromToStringBuilder, the output would look like this:Person@182f0db[ name=John Doe age=33 smoker=false ] 
- 
NO_FIELD_NAMES_STYLEThe no field names toString style. Using thePersonexample fromToStringBuilder, the output would look like this:Person@182f0db[John Doe,33,false] 
- 
SHORT_PREFIX_STYLEThe short prefix toString style. Using thePersonexample fromToStringBuilder, the output would look like this:Person[name=John Doe,age=33,smoker=false] - Since:
- 2.1
 
- 
SIMPLE_STYLEThe simple toString style. Using thePersonexample fromToStringBuilder, the output would look like this:John Doe,33,false 
- 
NO_CLASS_NAME_STYLEThe no class name toString style. Using thePersonexample fromToStringBuilder, the output would look like this:[name=John Doe,age=33,smoker=false] - Since:
- 3.4
 
- 
JSON_STYLEThe JSON toString style. Using thePersonexample 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 anUnsupportedOperationExceptionif 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:
 
 
- 
- 
Constructor Details- 
ToStringStyleprotected ToStringStyle()Constructs a new instance.
 
- 
- 
Method Details- 
getRegistryReturns the registry of objects being traversed by thereflectionToStringmethods in the current thread.- Returns:
- Set the registry of objects being traversed
 
- 
appendAppends to thetoStringabooleanvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringabooleanarray.- 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
 
- 
appendAppends to thetoStringabytevalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringabytearray.- 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
 
- 
appendAppends to thetoStringacharvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringachararray.- 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
 
- 
appendAppends to thetoStringadoublevalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringadoublearray.- 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
 
- 
appendAppends to thetoStringafloatvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringafloatarray.- 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
 
- 
appendAppends to thetoStringanintvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringanintarray.- 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
 
- 
appendAppends to the toStringalongvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringalongarray.- 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
 
- 
append- 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
 
- 
appendAppends to thetoStringanObjectarray.- 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
 
- 
appendAppends to thetoStringashortvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
- value- the value to add to the- toString
 
- 
appendAppends to thetoStringashortarray.- 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
 
- 
appendClassNameAppends to thetoStringthe class name.- Parameters:
- buffer- the- StringBufferto populate
- object- the- Objectwhose name to output
 
- 
appendContentEndAppends to thetoStringthe content end.- Parameters:
- buffer- the- StringBufferto populate
 
- 
appendContentStartAppends to thetoStringthe content start.- Parameters:
- buffer- the- StringBufferto populate
 
- 
appendCyclicObjectAppends to thetoStringanObjectvalue 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, not- null
- Since:
- 2.2
 
- 
appendDetailAppends to thetoStringabooleanvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringabytevalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringacharvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringaCollection.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- coll- the- Collectionto add to the- toString, not- null
 
- 
appendDetailAppends to thetoStringadoublevalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringafloatvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringanintvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringalongvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringaMap.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- map- the- Mapto add to the- toString, not- null
 
- 
appendDetail- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString, not- null
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendDetailAppends to thetoStringashortvalue.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString
 
- 
appendDetailAppends to thetoStringthe 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, not- null
 
- 
appendEndAppends to thetoStringthe end of data indicator.- Parameters:
- buffer- the- StringBufferto populate
- object- the- Objectto build a- toStringfor.
 
- 
appendFieldEndAppends to thetoStringthe field end.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
 
- 
appendFieldSeparatorAppends to thetoStringthe field separator.- Parameters:
- buffer- the- StringBufferto populate
 
- 
appendFieldStartAppends to thetoStringthe field start.- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name
 
- 
appendIdentityHashCodeAppends theSystem.identityHashCode(java.lang.Object).- Parameters:
- buffer- the- StringBufferto populate
- object- the- Objectwhose id to output
 
- 
appendInternalAppends to thetoStringanObject, 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, not- null
- detail- output detail or not
 
- 
appendNullTextAppends to thetoStringan indicator fornull.The default indicator is "<null>".- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
 
- 
appendStartAppends to thetoStringthe start of data indicator.- Parameters:
- buffer- the- StringBufferto populate
- object- the- Objectto build a- toStringfor
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummaryAppends to thetoStringa summary 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, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummary- Parameters:
- buffer- the- StringBufferto populate
- fieldName- the field name, typically not used as already appended
- value- the value to add to the- toString, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummaryAppends to thetoStringa 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, not- null
 
- 
appendSummarySizeAppends to thetoStringa 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
 
- 
appendSuperAppends to thetoStringthe 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
 
- 
appendToStringAppends to thetoStringanother 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
 
- 
getArrayEndGets the array end text.- Returns:
- the current array end text
 
- 
getArraySeparatorGets the array separator text.- Returns:
- the current array separator text
 
- 
getArrayStartGets the array start text.- Returns:
- the current array start text
 
- 
getContentEndGets the content end text.- Returns:
- the current content end text
 
- 
getContentStartGets the content start text.- Returns:
- the current content start text
 
- 
getFieldNameValueSeparatorGets the field name value separator text.- Returns:
- the current field name value separator text
 
- 
getFieldSeparatorGets the field separator text.- Returns:
- the current field separator text
 
- 
getNullTextGets the text to output whennullfound.- Returns:
- the current text to output when null found
 
- 
getShortClassNameGets 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
 
- 
getSizeEndTextGets the end text to output when aCollection,Mapor array size is output.This is output after the size value. - Returns:
- the current end of size text
 
- 
getSizeStartTextGets the start text to output when aCollection,Mapor array size is output.This is output before the size value. - Returns:
- the current start of size text
 
- 
getSummaryObjectEndTextGets the end text to output when anObjectis output in summary mode.This is output after the size value. - Returns:
- the current end of summary text
 
- 
getSummaryObjectStartTextGets the start text to output when anObjectis output in summary mode.This is output before the size value. - Returns:
- the current start of summary text
 
- 
isArrayContentDetailGets whether to output array content detail.- Returns:
- the current array content detail setting
 
- 
isDefaultFullDetailGets whether to use full detail when the caller doesn't specify.- Returns:
- the current defaultFullDetail flag
 
- 
isFieldSeparatorAtEndGets whether the field separator should be added at the end of each buffer.- Returns:
- fieldSeparatorAtEnd flag
- Since:
- 2.0
 
- 
isFieldSeparatorAtStartGets whether the field separator should be added at the start of each buffer.- Returns:
- the fieldSeparatorAtStart flag
- Since:
- 2.0
 
- 
isFullDetailIs this field to 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
 
- 
isUseClassNameGets whether to use the class name.- Returns:
- the current useClassName flag
 
- 
isUseFieldNamesGets whether to use the field names passed in.- Returns:
- the current useFieldNames flag
 
- 
isUseIdentityHashCodeGets whether to use the identity hash code.- Returns:
- the current useIdentityHashCode flag
 
- 
isUseShortClassNameGets whether to output short or long class names.- Returns:
- the current useShortClassName flag
- Since:
- 2.0
 
- 
reflectionAppendArrayDetailAppends to thetoStringthe 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, not- null
- Since:
- 2.0
 
- 
removeLastFieldSeparatorRemove the last field separator from the buffer.- Parameters:
- buffer- the- StringBufferto populate
- Since:
- 2.0
 
- 
setArrayContentDetailSets whether to output array content detail.- Parameters:
- arrayContentDetail- the new arrayContentDetail flag
 
- 
setArrayEndSets the array end text.nullis accepted, but will be converted to an empty String.- Parameters:
- arrayEnd- the new array end text
 
- 
setArraySeparatorSets the array separator text.nullis accepted, but will be converted to an empty String.- Parameters:
- arraySeparator- the new array separator text
 
- 
setArrayStartSets the array start text.nullis accepted, but will be converted to an empty String.- Parameters:
- arrayStart- the new array start text
 
- 
setContentEndSets the content end text.nullis accepted, but will be converted to an empty String.- Parameters:
- contentEnd- the new content end text
 
- 
setContentStartSets the content start text.nullis accepted, but will be converted to an empty String.- Parameters:
- contentStart- the new content start text
 
- 
setDefaultFullDetailSets whether to use full detail when the caller doesn't specify.- Parameters:
- defaultFullDetail- the new defaultFullDetail flag
 
- 
setFieldNameValueSeparatorSets 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
 
- 
setFieldSeparatorSets the field separator text.nullis accepted, but will be converted to an empty String.- Parameters:
- fieldSeparator- the new field separator text
 
- 
setFieldSeparatorAtEndSets whether the field separator should be added at the end of each buffer.- Parameters:
- fieldSeparatorAtEnd- the fieldSeparatorAtEnd flag
- Since:
- 2.0
 
- 
setFieldSeparatorAtStartSets whether the field separator should be added at the start of each buffer.- Parameters:
- fieldSeparatorAtStart- the fieldSeparatorAtStart flag
- Since:
- 2.0
 
- 
setNullTextSets the text to output whennullfound.nullis accepted, but will be converted to an empty String.- Parameters:
- nullText- the new text to output when null found
 
- 
setSizeEndTextSets the end text to output when aCollection,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
 
- 
setSizeStartTextSets the start text to output when aCollection,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
 
- 
setSummaryObjectEndTextSets the end text to output when anObjectis 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
 
- 
setSummaryObjectStartTextSets the start text to output when anObjectis 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
 
- 
setUseClassNameSets whether to use the class name.- Parameters:
- useClassName- the new useClassName flag
 
- 
setUseFieldNamesSets whether to use the field names passed in.- Parameters:
- useFieldNames- the new useFieldNames flag
 
- 
setUseIdentityHashCodeSets whether to use the identity hash code.- Parameters:
- useIdentityHashCode- the new useIdentityHashCode flag
 
- 
setUseShortClassNameSets whether to output short or long class names.- Parameters:
- useShortClassName- the new useShortClassName flag
- Since:
- 2.0
 
 
-