org.springframework.core.style

## Class DefaultToStringStyler

- java.lang.Object
- - org.springframework.core.style.DefaultToStringStyler

- All Implemented Interfaces:
    ToStringStyler

      public class DefaultToStringStyler
      extends Object
      implements ToStringStyler

  Spring's default `toString()` styler.

  This class is used by `ToStringCreator` to style `toString()` output in a consistent manner according to Spring conventions.

  Since:
    1.2.2
  Author:
    Keith Donald, Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultToStringStyler(ValueStyler valueStyler)` Create a new DefaultToStringStyler.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ValueStyler` | `getValueStyler()` Return the ValueStyler used by this ToStringStyler.
    `void` | `styleEnd(StringBuilder buffer, Object o)` Style a `toString()`'ed object after it's fields are styled.
    `void` | `styleField(StringBuilder buffer, String fieldName, Object value)` Style a field value as a string.
    `protected void` | `styleFieldEnd(StringBuilder buffer, String fieldName)`
    `void` | `styleFieldSeparator(StringBuilder buffer)` Style the field separator.
    `protected void` | `styleFieldStart(StringBuilder buffer, String fieldName)`
    `void` | `styleStart(StringBuilder buffer, Object obj)` Style a `toString()`'ed object before its fields are styled.
    `void` | `styleValue(StringBuilder buffer, Object value)` Style the given value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultToStringStyler

          public DefaultToStringStyler(ValueStyler valueStyler)

      Create a new DefaultToStringStyler.
      Parameters:
        `valueStyler` - the ValueStyler to use

  - ### Method Detail

    - #### getValueStyler

          protected final ValueStyler getValueStyler()

      Return the ValueStyler used by this ToStringStyler.

    - #### styleStart

          public void styleStart(StringBuilder buffer,
                                 Object obj)

      Description copied from interface: `ToStringStyler`
      Style a `toString()`'ed object before its fields are styled.
      Specified by:
        `styleStart` in interface `ToStringStyler`
      Parameters:
        `buffer` - the buffer to print to
        `obj` - the object to style

    - #### styleEnd

          public void styleEnd(StringBuilder buffer,
                               Object o)

      Description copied from interface: `ToStringStyler`
      Style a `toString()`'ed object after it's fields are styled.
      Specified by:
        `styleEnd` in interface `ToStringStyler`
      Parameters:
        `buffer` - the buffer to print to
        `o` - the object to style

    - #### styleField

          public void styleField(StringBuilder buffer,
                                 String fieldName,
                                 Object value)

      Description copied from interface: `ToStringStyler`
      Style a field value as a string.
      Specified by:
        `styleField` in interface `ToStringStyler`
      Parameters:
        `buffer` - the buffer to print to
        `fieldName` - the he name of the field
        `value` - the field value

    - #### styleFieldStart

          protected void styleFieldStart(StringBuilder buffer,
                                         String fieldName)

    - #### styleFieldEnd

          protected void styleFieldEnd(StringBuilder buffer,
                                       String fieldName)

    - #### styleValue

          public void styleValue(StringBuilder buffer,
                                 Object value)

      Description copied from interface: `ToStringStyler`
      Style the given value.
      Specified by:
        `styleValue` in interface `ToStringStyler`
      Parameters:
        `buffer` - the buffer to print to
        `value` - the field value

    - #### styleFieldSeparator

          public void styleFieldSeparator(StringBuilder buffer)

      Description copied from interface: `ToStringStyler`
      Style the field separator.
      Specified by:
        `styleFieldSeparator` in interface `ToStringStyler`
      Parameters:
        `buffer` - buffer to print to