Class OptionUtil


  • public final class OptionUtil
    extends java.lang.Object
    Utility functions related to Option handling.
    Since:
    0.2
    Author:
    Erich Schubert
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private OptionUtil()
      Fake constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.StringBuilder describeParameterizable​(java.lang.StringBuilder buf, java.lang.Class<?> pcls, int width)
      Format a description of a Parameterizable (including recursive options).
      static void formatForConsole​(java.lang.StringBuilder buf, int width, java.util.Collection<TrackedParameter> options)
      Format a list of options (and associated owning objects) for console help output.
      static java.lang.String getFullDescription​(Parameter<?> param)
      Format a parameter description.
      private static void println​(java.lang.StringBuilder buf, int width, java.lang.String data)
      Simple writing helper with no indentation.
      • Methods inherited from class java.lang.Object

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

      • OptionUtil

        private OptionUtil()
        Fake constructor. Use static method.
    • Method Detail

      • formatForConsole

        public static void formatForConsole​(java.lang.StringBuilder buf,
                                            int width,
                                            java.util.Collection<TrackedParameter> options)
        Format a list of options (and associated owning objects) for console help output.
        Parameters:
        buf - Serialization buffer
        width - Screen width
        options - List of options
      • getFullDescription

        public static java.lang.String getFullDescription​(Parameter<?> param)
        Format a parameter description.
        Parameters:
        param - Parameter
        Returns:
        Parameter description
      • println

        private static void println​(java.lang.StringBuilder buf,
                                    int width,
                                    java.lang.String data)
        Simple writing helper with no indentation.
        Parameters:
        buf - Buffer to write to
        width - Width to use for linewraps
        data - Data to write.
      • describeParameterizable

        public static java.lang.StringBuilder describeParameterizable​(java.lang.StringBuilder buf,
                                                                      java.lang.Class<?> pcls,
                                                                      int width)
                                                               throws ClassInstantiationException
        Format a description of a Parameterizable (including recursive options).
        Parameters:
        buf - Buffer to append to.
        pcls - Parameterizable class to describe
        width - Width
        Returns:
        Formatted description
        Throws:
        ClassInstantiationException