org.apache.fulcrum.yaafi.interceptor.util
Class ArgumentToStringBuilderImpl

java.lang.Object
  extended by 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 Summary
static int INCLUDE_CLASSNAME
          include the class name in the result
static int INCLUDE_HASHCODE
          include the hashcode in the result
 
Constructor Summary
ArgumentToStringBuilderImpl()
          Constructor
ArgumentToStringBuilderImpl(Object target)
          Constructor
ArgumentToStringBuilderImpl(Object target, int maxArgLength)
          Constructor
ArgumentToStringBuilderImpl(Object target, int maxArgLength, int mode)
          Constructor
 
Method Summary
protected  void append(String source)
          Append a string to the internal buffer
protected  void appendChar(char ch)
          Append the hash code.
protected  void appendClassName(Object target)
          Append the class name.
protected  void appendHashCode(Object target)
          Append the hash code.
protected  String format(String source)
          Format the buffer by replacing the whitespaces and cutting away excessive fluff.
protected  int getMaxArgLength()
           
 int getMode()
           
protected  String getStackTrace(Throwable throwable)
          Gets the stack trace from a Throwable as a String.
 void setMaxArgLength(int maxArgLength)
           
 void setMode(int mode)
           
 void setTarget(Object target)
           
 String toString()
          Invokes the string builder.
protected  String toString(boolean[] array)
          Create a string representation of a boolean[].
protected  String toString(byte[] array)
          Create a string representation of a char[].
protected  String toString(char[] array)
          Create a string representation of a char[].
protected  String toString(Collection collection)
          Create a string representation of a java.util.Collection.
protected  String toString(Dictionary dictionary)
          Create a string representation of a Dictionary.
protected  String toString(double[] array)
          Create a string representation of a double[].
protected  String toString(float[] array)
          Create a string representation of a float[].
protected  String toString(int[] array)
          Create a string representation of a int[].
protected  String toString(long[] array)
          Create a string representation of a char[].
protected  String toString(Object object)
          Create a String representation for an arbitrary object.
protected  String toString(Object[] array)
          Create a string representation of an object array.
protected  String toString(short[] array)
          Create a string representation of a short[].
protected  String toString(String string)
          Create a string representation of a String.
protected  String toString(Throwable throwable)
          Create a String representation for a Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INCLUDE_CLASSNAME

public static final int INCLUDE_CLASSNAME
include the class name in the result

See Also:
Constant Field Values

INCLUDE_HASHCODE

public static final int INCLUDE_HASHCODE
include the hashcode in the result

See Also:
Constant Field Values
Constructor Detail

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 Detail

setMaxArgLength

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

setTarget

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

setMode

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

getMode

public int getMode()
Returns:
Returns the mode.

toString

public String toString()
Description copied from interface: InterceptorToStringBuilder
Invokes the string builder.

Specified by:
toString in interface InterceptorToStringBuilder
Overrides:
toString in class Object
See Also:
Object.toString()

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

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


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.