Class PrettyPrinter


  • public class PrettyPrinter
    extends Object
    Very simple class to produce String versions of beans and other objects.

    For beans, the entire hierarchy of associations for each object is printed in a tree-like format. This is primarily used for testing.

    Author:
    pavlidis
    • Method Detail

      • print

        public static String print​(Collection<String> packages,
                                   Collection<Object> beans)
        Print out a collection of beans in a relatively pleasing format.
        Parameters:
        packages - collection of Strings for inclusion of classes for printing. E.g. "ubic.gemma" would print all classes in the ubic.gemma package (including subpackages). If empty, everything gets printed.
        beans - Collection of beans.
        Returns:
        String representing the objects.
      • print

        public static String print​(Collection<String> packages,
                                   Object object)
        Pretty-print a single bean. Beans that are not part of this project are ignored.
        Parameters:
        packages - collection of Strings for inclusion of classes for printing. E.g. "ubic.gemma" would print all classes in the ubic.gemma package (including subpackages). If empty, everything gets printed.
        object -
        Returns:
        String representing the object.
      • print

        public static String print​(Collection<String> packages,
                                   Object[] objects)
        Print out a collection of objects in a relatively pleasing format.
        Parameters:
        packages - collection of Strings for inclusion of classes for printing. E.g. "ubic.gemma" would print all classes in the ubic.gemma package (including subpackages). If empty, everything gets printed.
        beans - Collection of beans.
        Returns:
        String representing the objects.