Class Debug


  • public class Debug
    extends Object
    Utility methods that help with debugging.
    • Constructor Detail

      • Debug

        public Debug()
    • 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 (see abbreviatedName(Class)), an '@' character, then a gibberish word representing the object's identity hash code (see toMemorableString(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:
        1. the first letter of each component of the package name
        2. a dot
        3. 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.