Class ArgumentToStringBuilderImpl
java.lang.Object
org.apache.fulcrum.yaafi.interceptor.util.ArgumentToStringBuilderImpl
- All Implemented Interfaces:
InterceptorToStringBuilder
Creates a string representation of method argument.
- Author:
- Siegfried Goeschl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
include the class name in the resultstatic final int
include the hashcode in the result -
Constructor Summary
ConstructorsConstructorDescriptionConstructorArgumentToStringBuilderImpl
(Object target) ConstructorArgumentToStringBuilderImpl
(Object target, int maxArgLength) ConstructorArgumentToStringBuilderImpl
(Object target, int maxArgLength, int mode) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Append a string to the internal bufferprotected 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 the buffer by replacing the whitespaces and cutting away excessive fluff.protected int
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
toString()
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
(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
(short[] array) Create a string representation of a short[].protected String
Create a String representation for an arbitrary object.protected String
Create a string representation of an object array.protected String
Create a string representation of a String.protected String
Create a String representation for a Throwable.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.
-
Field Details
-
INCLUDE_CLASSNAME
public static final int INCLUDE_CLASSNAMEinclude the class name in the result- See Also:
-
INCLUDE_HASHCODE
public static final int INCLUDE_HASHCODEinclude the hashcode in the result- See Also:
-
-
Constructor Details
-
ArgumentToStringBuilderImpl
public ArgumentToStringBuilderImpl()Constructor -
ArgumentToStringBuilderImpl
Constructor- Parameters:
target
- the object to print
-
ArgumentToStringBuilderImpl
Constructor- Parameters:
target
- the object to printmaxArgLength
- the maximum length
-
ArgumentToStringBuilderImpl
Constructor- Parameters:
target
- the object to printmaxArgLength
- the maximum lengthmode
- the formatting mode to use
-
-
Method Details
-
setMaxArgLength
public void setMaxArgLength(int maxArgLength) - Specified by:
setMaxArgLength
in interfaceInterceptorToStringBuilder
- Parameters:
maxArgLength
- The maxArgLength to set.- See Also:
-
setTarget
- Specified by:
setTarget
in interfaceInterceptorToStringBuilder
- Parameters:
target
- The target to set.- See Also:
-
setMode
public void setMode(int mode) - Specified by:
setMode
in interfaceInterceptorToStringBuilder
- Parameters:
mode
- Set the formatting mode to use- See Also:
-
getMode
public int getMode()- Returns:
- Returns the mode.
-
toString
-
toString
Create a String representation for a Throwable.- Parameters:
throwable
- the Throwable- Returns:
- the string representation
-
toString
Create a string representation of an object array.- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a boolean[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a char[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a short[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a int[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a char[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a float[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a double[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a String.- Parameters:
string
- the string to print- Returns:
- the result
-
toString
Create a string representation of a char[].- Parameters:
array
- the array to print- Returns:
- the result
-
toString
Create a string representation of a java.util.Collection.- Parameters:
collection
- the collection to print- Returns:
- the result
-
toString
Create a string representation of a Dictionary.- Parameters:
dictionary
- the collection to print- Returns:
- the result
-
toString
Create a String representation for an arbitrary object.- Parameters:
object
- the object- Returns:
- string representation
-
appendHashCode
Append the hash code.- Parameters:
target
- the object to print
-
appendClassName
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
Gets the stack trace from a Throwable as a String.
- Parameters:
throwable
- theThrowable
to be examined- Returns:
- the stack trace as generated by the exception's
printStackTrace(PrintWriter)
method
-
append
Append a string to the internal buffer- Parameters:
source
- the string to append
-
format
Format the buffer by replacing the whitespaces and cutting away excessive fluff.- Parameters:
source
- the source string- Returns:
- formatted string
-