Class Pretty


  • public class Pretty
    extends java.lang.Object
    Utility class to print the variety of types, useful in toString method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String CONSTRUCTOR_NAME  
      private static java.lang.String DOT  
      private static java.lang.String NULL_STRING  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Pretty()
      Private constructor to forbid the creation of Pretty instance.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String array​(java.lang.Object[] array)
      Returns a pretty string for the given array.
      static java.lang.String clazz​(java.lang.Class<?> clazz)
      Makes a nice, pretty class (without the package name).
      static java.lang.String collection​(java.util.Collection<?> collection)
      Returns a pretty string representing the collection.
      static java.lang.String constructor​(java.lang.reflect.Constructor<?> constructor)
      Make a nice pretty string out of the constructor and all its parameters.
      static java.lang.String field​(java.lang.reflect.Field field)
      Returns a pretty string representing a Field.
      static java.lang.String method​(java.lang.reflect.Method method)
      Makes a nice pretty string of the method, with the method name and all parameters.
      private static java.lang.String prettyPrintParameters​(java.lang.Class<?>[] params)  
      static java.lang.String pType​(java.lang.reflect.ParameterizedType pType)
      Prints a pretty parameterized type.
      static java.lang.String type​(java.lang.reflect.Type t)
      Returns a pretty string for the given type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Pretty

        private Pretty()
        Private constructor to forbid the creation of Pretty instance.
    • Method Detail

      • clazz

        public static java.lang.String clazz​(java.lang.Class<?> clazz)
        Makes a nice, pretty class (without the package name).
        Parameters:
        clazz - Make me a pretty class.
        Returns:
        A nice string of the class, with no package.
      • pType

        public static java.lang.String pType​(java.lang.reflect.ParameterizedType pType)
        Prints a pretty parameterized type.
        Parameters:
        pType - The parameterized type to print. May not be null.
        Returns:
        A pretty string version of the parameterized type.
      • type

        public static java.lang.String type​(java.lang.reflect.Type t)
        Returns a pretty string for the given type.
        Parameters:
        t - A possibly null type.
        Returns:
        A pretty string representing the type.
      • constructor

        public static java.lang.String constructor​(java.lang.reflect.Constructor<?> constructor)
        Make a nice pretty string out of the constructor and all its parameters.
        Parameters:
        constructor - The constructor to make pretty.
        Returns:
        A nice pretty string.
      • method

        public static java.lang.String method​(java.lang.reflect.Method method)
        Makes a nice pretty string of the method, with the method name and all parameters.
        Parameters:
        method - The method to make pretty.
        Returns:
        A nice pretty string.
      • field

        public static java.lang.String field​(java.lang.reflect.Field field)
        Returns a pretty string representing a Field.
        Parameters:
        field - The possibly null field.
        Returns:
        A pretty string representing the field.
      • array

        public static java.lang.String array​(java.lang.Object[] array)
        Returns a pretty string for the given array.
        Parameters:
        array - The possibly null array to represent.
        Returns:
        A pretty string representation of the array.
      • collection

        public static java.lang.String collection​(java.util.Collection<?> collection)
        Returns a pretty string representing the collection.
        Parameters:
        collection - A possibly null collection to represent.
        Returns:
        A pretty string representing the collection.
      • prettyPrintParameters

        private static java.lang.String prettyPrintParameters​(java.lang.Class<?>[] params)