org.springframework.core.style

Class 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 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