Class StatsPrinter

java.lang.Object
se.liu.ida.hefquin.base.utils.StatsPrinter

public class StatsPrinter extends Object
A utility class for converting Stats objects into JSON format and printing them.
  • Constructor Details

    • StatsPrinter

      public StatsPrinter()
  • Method Details

    • print

      public static void print(Stats s, PrintStream out, boolean recursive)
      Converts the given Stats object into a JSON object and, then, prints that JSON object to the specified PrintStream.
      Parameters:
      s - - the Stats object to print
      out - - the output stream to print to
      recursive - - true if nested Stats entries should be printed recursively
    • statsAsJson

      public static org.apache.jena.atlas.json.JsonObject statsAsJson(Stats s)
      Converts the given Stats object into a JSON object. Nested Stats entries are converted recursively.
      Parameters:
      s - - the Stats object to convert
    • statsAsJson

      public static org.apache.jena.atlas.json.JsonObject statsAsJson(Stats s, boolean recursive)
      Converts the given Stats object into a JSON object.
      Parameters:
      s - - the Stats object to convert
      recursive - - true if nested Stats entries should be printed recursively
      Returns:
      a JSON object representation of the Stats object
    • asJson

      protected static org.apache.jena.atlas.json.JsonValue asJson(Object entry, boolean recursive)
      Converts the given object into a JSON value.
      Parameters:
      recursive - - true if nested Stats entries should be printed recursively
      s - - the Stats object to convert
      Returns:
      a JSON representation of the given object