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 intinclude the class name in the resultstatic final intinclude 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 voidAppend a string to the internal bufferprotected voidappendChar(char ch) Append the hash code.protected voidappendClassName(Object target) Append the class name.protected voidappendHashCode(Object target) Append the hash code.protected StringFormat the buffer by replacing the whitespaces and cutting away excessive fluff.protected intintgetMode()protected StringgetStackTrace(Throwable throwable) Gets the stack trace from a Throwable as a String.voidsetMaxArgLength(int maxArgLength) voidsetMode(int mode) voidtoString()protected StringtoString(boolean[] array) Create a string representation of a boolean[].protected StringtoString(byte[] array) Create a string representation of a char[].protected StringtoString(char[] array) Create a string representation of a char[].protected StringtoString(double[] array) Create a string representation of a double[].protected StringtoString(float[] array) Create a string representation of a float[].protected StringtoString(int[] array) Create a string representation of a int[].protected StringtoString(long[] array) Create a string representation of a char[].protected StringtoString(short[] array) Create a string representation of a short[].protected StringCreate a String representation for an arbitrary object.protected StringCreate a string representation of an object array.protected StringCreate a string representation of a String.protected StringCreate a String representation for a Throwable.protected StringtoString(Collection<?> collection) Create a string representation of a java.util.Collection.protected StringtoString(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:
setMaxArgLengthin interfaceInterceptorToStringBuilder- Parameters:
maxArgLength- The maxArgLength to set.- See Also:
-
setTarget
- Specified by:
setTargetin interfaceInterceptorToStringBuilder- Parameters:
target- The target to set.- See Also:
-
setMode
public void setMode(int mode) - Specified by:
setModein 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- theThrowableto 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
-