Class ArgumentToStringBuilderImpl

java.lang.Object
org.apache.fulcrum.yaafi.interceptor.util.ArgumentToStringBuilderImpl
All Implemented Interfaces:
InterceptorToStringBuilder

public class ArgumentToStringBuilderImpl extends Object implements InterceptorToStringBuilder
Creates a string representation of method argument.
Author:
Siegfried Goeschl
  • Field Details

    • INCLUDE_CLASSNAME

      public static final int INCLUDE_CLASSNAME
      include the class name in the result
      See Also:
    • INCLUDE_HASHCODE

      public static final int INCLUDE_HASHCODE
      include the hashcode in the result
      See Also:
  • Constructor Details

    • ArgumentToStringBuilderImpl

      public ArgumentToStringBuilderImpl()
      Constructor
    • ArgumentToStringBuilderImpl

      public ArgumentToStringBuilderImpl(Object target)
      Constructor
      Parameters:
      target - the object to print
    • ArgumentToStringBuilderImpl

      public ArgumentToStringBuilderImpl(Object target, int maxArgLength)
      Constructor
      Parameters:
      target - the object to print
      maxArgLength - the maximum length
    • ArgumentToStringBuilderImpl

      public ArgumentToStringBuilderImpl(Object target, int maxArgLength, int mode)
      Constructor
      Parameters:
      target - the object to print
      maxArgLength - the maximum length
      mode - the formatting mode to use
  • Method Details

    • setMaxArgLength

      public void setMaxArgLength(int maxArgLength)
      Specified by:
      setMaxArgLength in interface InterceptorToStringBuilder
      Parameters:
      maxArgLength - The maxArgLength to set.
      See Also:
    • setTarget

      public void setTarget(Object target)
      Specified by:
      setTarget in interface InterceptorToStringBuilder
      Parameters:
      target - The target to set.
      See Also:
    • setMode

      public void setMode(int mode)
      Specified by:
      setMode in interface InterceptorToStringBuilder
      Parameters:
      mode - Set the formatting mode to use
      See Also:
    • getMode

      public int getMode()
      Returns:
      Returns the mode.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • toString

      protected String toString(Throwable throwable)
      Create a String representation for a Throwable.
      Parameters:
      throwable - the Throwable
      Returns:
      the string representation
    • toString

      protected String toString(Object[] array)
      Create a string representation of an object array.
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(boolean[] array)
      Create a string representation of a boolean[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(char[] array)
      Create a string representation of a char[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(short[] array)
      Create a string representation of a short[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(int[] array)
      Create a string representation of a int[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(long[] array)
      Create a string representation of a char[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(float[] array)
      Create a string representation of a float[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(double[] array)
      Create a string representation of a double[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(String string)
      Create a string representation of a String.
      Parameters:
      string - the string to print
      Returns:
      the result
    • toString

      protected String toString(byte[] array)
      Create a string representation of a char[].
      Parameters:
      array - the array to print
      Returns:
      the result
    • toString

      protected String toString(Collection<?> collection)
      Create a string representation of a java.util.Collection.
      Parameters:
      collection - the collection to print
      Returns:
      the result
    • toString

      protected String toString(Dictionary<?,?> dictionary)
      Create a string representation of a Dictionary.
      Parameters:
      dictionary - the collection to print
      Returns:
      the result
    • toString

      protected String toString(Object object)
      Create a String representation for an arbitrary object.
      Parameters:
      object - the object
      Returns:
      string representation
    • appendHashCode

      protected void appendHashCode(Object target)
      Append the hash code.
      Parameters:
      target - the object to print
    • appendClassName

      protected void appendClassName(Object target)
      Append the class name.
      Parameters:
      target - the object to print
    • appendChar

      protected void appendChar(char ch)
      Append the hash code.
      Parameters:
      ch - the object to print
    • getMaxArgLength

      protected int getMaxArgLength()
      Returns:
      Returns the maxLineLength.
    • getStackTrace

      protected String getStackTrace(Throwable throwable)

      Gets the stack trace from a Throwable as a String.

      Parameters:
      throwable - the Throwable to be examined
      Returns:
      the stack trace as generated by the exception's printStackTrace(PrintWriter) method
    • append

      protected void append(String source)
      Append a string to the internal buffer
      Parameters:
      source - the string to append
    • format

      protected String format(String source)
      Format the buffer by replacing the whitespaces and cutting away excessive fluff.
      Parameters:
      source - the source string
      Returns:
      formatted string