Package org.openjdk.jmc.common.util
Class FormatToolkit
- java.lang.Object
-
- org.openjdk.jmc.common.util.FormatToolkit
-
public class FormatToolkit extends java.lang.ObjectMethods for formatting IMC* instances.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringARRAYprivate static charCLASS_PREFIXprivate static charCLASS_SUFFIXprivate static java.lang.StringCOMMA_SEPARATORprivate static charLBprivate static charLPprivate static charPACKAGE_SEPARATORprivate static charRP
-
Constructor Summary
Constructors Constructor Description FormatToolkit()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringgetClass(java.lang.String clazz, boolean qualified)static java.lang.StringgetHumanReadable(IMCClassLoader classLoader)Get a human readable string representing a classloader.static java.lang.StringgetHumanReadable(IMCMethod method)Get a human readable string representing a method, displays all available informationstatic java.lang.StringgetHumanReadable(IMCMethod method, boolean showReturnValue, boolean showReturnValuePackage, boolean showClassName, boolean showClassPackageName, boolean showArguments, boolean showArgumentsPackage)Get a human readable string representing a method.static java.lang.StringgetHumanReadable(IMCStackTrace trace)Get a human readable string representing a stack trace, displays all available information.static java.lang.StringgetHumanReadable(IMCStackTrace trace, boolean showReturnValue, boolean showReturnValuePackage, boolean showClassName, boolean showClassPackageName, boolean showArguments, boolean showArgumentsPackage, int maximumVisibleStackTraceElements, java.lang.String indent, java.lang.String linePrefix, java.lang.String lineSeparator)Get a human readable string representing a stack trace.static java.lang.StringgetHumanReadable(IMCStackTrace trace, java.lang.String indent, java.lang.String linePrefix, java.lang.String lineSeparator)Get a human readable string representing a stack trace, displays all available information.static java.lang.StringgetPackage(IMCPackage mcPackage)Get the package name as a human readable string.private static java.lang.StringgetParameters(java.lang.String descriptor, boolean qualified)private static java.lang.StringgetPrimitiveType(char ch)private static java.lang.StringgetReturnType(java.lang.String descriptor, boolean qualified)static java.lang.StringgetType(IMCType type, boolean qualified)Get the type name as a human readable string.private static intparseToken(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified)private static intreadArray(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified)private static intreadComponentType(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified)private static intreadPrimitive(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified)private static intwrite(java.lang.StringBuffer output, java.lang.String string, int next_position)
-
-
-
Field Detail
-
LP
private static final char LP
- See Also:
- Constant Field Values
-
RP
private static final char RP
- See Also:
- Constant Field Values
-
LB
private static final char LB
- See Also:
- Constant Field Values
-
CLASS_SUFFIX
private static final char CLASS_SUFFIX
- See Also:
- Constant Field Values
-
CLASS_PREFIX
private static final char CLASS_PREFIX
- See Also:
- Constant Field Values
-
PACKAGE_SEPARATOR
private static final char PACKAGE_SEPARATOR
- See Also:
- Constant Field Values
-
COMMA_SEPARATOR
private static final java.lang.String COMMA_SEPARATOR
- See Also:
- Constant Field Values
-
ARRAY
private static final java.lang.String ARRAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getHumanReadable
public static java.lang.String getHumanReadable(IMCMethod method)
Get a human readable string representing a method, displays all available information- Returns:
- a human readable string representing the method
-
getHumanReadable
public static java.lang.String getHumanReadable(IMCMethod method, boolean showReturnValue, boolean showReturnValuePackage, boolean showClassName, boolean showClassPackageName, boolean showArguments, boolean showArgumentsPackage)
Get a human readable string representing a method.- Parameters:
method- the method to get a string forshowReturnValue-trueif the return value type should be includedshowReturnValuePackage-trueif the package name of the return value type should be included. Only relevant ifshowReturnValueistrue.showClassName-trueif the class name for the method should be includedshowClassPackageName-trueif the package name of the class for the method should be included. Only relevant ifshowClassNameistrue.showArguments-trueif the class names for the method arguments should be includedshowArgumentsPackage-trueif the package names of the classes for the method arguments should be included. Only relevant ifshowArgumentsistrue.- Returns:
- a human readable string representing the method
-
getPackage
public static java.lang.String getPackage(IMCPackage mcPackage)
Get the package name as a human readable string. If it is the default package (the empty string), then get a describing text for that.- Parameters:
mcPackage- package instance to format- Returns:
- the package name
-
getType
public static java.lang.String getType(IMCType type, boolean qualified)
Get the type name as a human readable string.- Parameters:
type- type instance to formatqualified-trueif the returned string should be fully qualified- Returns:
- the type name, fully qualified if requested so
-
getReturnType
private static java.lang.String getReturnType(java.lang.String descriptor, boolean qualified) throws java.lang.Exception- Throws:
java.lang.Exception
-
getParameters
private static java.lang.String getParameters(java.lang.String descriptor, boolean qualified) throws java.lang.Exception- Throws:
java.lang.Exception
-
parseToken
private static int parseToken(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified) throws java.lang.Exception- Throws:
java.lang.Exception
-
readArray
private static int readArray(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified) throws java.lang.Exception- Throws:
java.lang.Exception
-
readPrimitive
private static int readPrimitive(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified) throws java.lang.Exception- Throws:
java.lang.Exception
-
write
private static int write(java.lang.StringBuffer output, java.lang.String string, int next_position)
-
readComponentType
private static int readComponentType(java.lang.StringBuffer output, java.lang.String input, int position, boolean qualified)
-
getClass
private static java.lang.String getClass(java.lang.String clazz, boolean qualified)
-
getPrimitiveType
private static java.lang.String getPrimitiveType(char ch)
-
getHumanReadable
public static java.lang.String getHumanReadable(IMCStackTrace trace)
Get a human readable string representing a stack trace, displays all available information.- Parameters:
trace- the stack trace to get a string for- Returns:
- a human readable string representing the stack trace
-
getHumanReadable
public static java.lang.String getHumanReadable(IMCStackTrace trace, java.lang.String indent, java.lang.String linePrefix, java.lang.String lineSeparator)
Get a human readable string representing a stack trace, displays all available information.- Parameters:
trace- the stack trace to get a string forindent- string to use for indentation, defaults to four spaces if parameter is nulllinePrefix- string to use as a line prefix, defaults to "at " if parameter is null string to use for indentationlineSeparator- string to use as line separator, defaults to line separator property if parameter is null- Returns:
- a human readable string representing the stack trace
-
getHumanReadable
public static java.lang.String getHumanReadable(IMCStackTrace trace, boolean showReturnValue, boolean showReturnValuePackage, boolean showClassName, boolean showClassPackageName, boolean showArguments, boolean showArgumentsPackage, int maximumVisibleStackTraceElements, java.lang.String indent, java.lang.String linePrefix, java.lang.String lineSeparator)
Get a human readable string representing a stack trace.- Parameters:
trace- the stack trace to get a string forshowReturnValue-trueif the return value type should be includedshowReturnValuePackage-trueif the package name of the return value type should be included. Only relevant ifshowReturnValueistrue.showClassName-trueif the class name for the method should be includedshowClassPackageName-trueif the package name of the class for the method should be included. Only relevant ifshowClassNameistrue.showArguments-trueif the class names for the method arguments should be includedshowArgumentsPackage-trueif the package names of the classes for the method arguments should be included. Only relevant ifshowArgumentsistrue.indent- string to use for indentation, defaults to four spaces if parameter is nulllinePrefix- string to use as a line prefix, defaults to "at " if parameter is null string to use for indentationlineSeparator- string to use as line separator, defaults to line separator property if parameter is null- Returns:
- a human readable string representing the stack trace
-
getHumanReadable
public static java.lang.String getHumanReadable(IMCClassLoader classLoader)
Get a human readable string representing a classloader.- Parameters:
classLoader- the classloader to get a string for- Returns:
- a human readable string representing the classloader
-
-