Class DefaultPrinter

    • Method Detail

      • appendUsage

        public String[] appendUsage​(String[] customUsage)
      • setObjectToMap

        public void setObjectToMap​(Map<Class<?>,​Function<Object,​Map<String,​Object>>> objectToMap)
        Override ScriptEngine toMap() method
        Parameters:
        objectToMap - key: object class, value: toMap function
      • setObjectToString

        public void setObjectToString​(Map<Class<?>,​Function<Object,​String>> objectToString)
        Override ScriptEngine toString() method
        Parameters:
        objectToString - key: object class, value: toString function
      • setHighlightValue

        public void setHighlightValue​(Map<String,​Function<Object,​AttributedString>> highlightValue)
        Highlight column value
        Parameters:
        highlightValue - key: regex for column name, value: highlight function
      • terminal

        protected Terminal terminal()
        Returns:
        terminal to which will be printed
      • manageBooleanOptions

        protected void manageBooleanOptions​(Map<String,​Object> options)
        Boolean printing options Printer checks only if key is present. Boolean options that have false value are removed from the options Map.
        Parameters:
        options - printing options
      • defaultPrntOptions

        protected Map<String,​Object> defaultPrntOptions​(boolean skipDefault)
        Set default and mandatory printing options. Also unsupported options will be removed when Printer is used without scriptEngine
        Parameters:
        skipDefault - when true does not set default options
        Returns:
        default, mandatory and supported options
      • highlightAndPrint

        protected void highlightAndPrint​(Map<String,​Object> options,
                                         Throwable exception)
        Highlight and print an exception
        Parameters:
        options - Printing options
        exception - Exception to be printed