Package org.uberfire.debug
Class Debug
- java.lang.Object
-
- org.uberfire.debug.Debug
-
public class Debug extends Object
Utility methods that help with debugging.
-
-
Constructor Summary
Constructors Constructor Description Debug()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringabbreviatedName(Class<?> c)Returns a compact representation of the fully-qualified name of the given class.static StringobjectId(Object o)Composes a compact, memorable unique string for the given object instance.static StringshortName(Class<?> c)Returns the short name of the given class (no package name).static StringtoMemorableString(long num)Makes a reasonably easy-to-pronounce gibberish word from the given number.
-
-
-
Method Detail
-
toMemorableString
public static String toMemorableString(long num)
Makes a reasonably easy-to-pronounce gibberish word from the given number. On average, the word will have about as many characters as the number would have when printed as a decimal, but (especially for large numbers) it will be easier to remember as a single word.- Parameters:
num- The number to convert.- Returns:
- The memorable string, unique to the given number. Never null.
-
objectId
public static String objectId(Object o)
Composes a compact, memorable unique string for the given object instance. The name starts with the abbreviated fully-qualified class name (seeabbreviatedName(Class)), an '@' character, then a gibberish word representing the object's identity hash code (seetoMemorableString(long)).- Parameters:
o-- Returns:
-
abbreviatedName
public static String abbreviatedName(Class<?> c)
Returns a compact representation of the fully-qualified name of the given class. The string is built with the following components:- the first letter of each component of the package name
- a dot
- the class name. If the class is an inner class, the name is of the form Outer$Inner
For classes in the default package, items 1 and 2 are omitted.
- Parameters:
c- the class whose name to abbreviate. Can be null, but will result in a null return value.- Returns:
- the abbreviated FQCN as described, or null if the input is null.
-
shortName
public static String shortName(Class<?> c)
Returns the short name of the given class (no package name). This is the same as java.lang.Class.shortName(), which is not implemented in the GWT version of java.lang.Class.- Parameters:
c- the class whose name to abbreviate. Can be null, but will result in a null return value.- Returns:
- the abbreviated FQCN as described, or null if the input is null.
-
-