Class ConfigMeta

  • Direct Known Subclasses:
    MinimalConfigMeta

    public class ConfigMeta
    extends java.lang.Object
    Contains metadata about configuration items.

    A number of the setter methods return this object, to facilitate declarations where method invocations are chained so that the configured metadata object can be returned in a single expression rather than multiple statements (cf StringBuffer).

    Since:
    22 Feb 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigMeta​(java.lang.String shortName, java.lang.String longName)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ConfigMeta appendXmlDescription​(java.lang.String[] moreXml)
      Convenience method to add additional lines to the existing XML documentation string.
      static java.lang.String capitalise​(java.lang.String word)
      Uppercases the first letter of a string.
      java.lang.String getLongName()
      Returns a potentially more descriptive name suitable for use in a GUI.
      java.lang.String getShortDescription()
      Returns a short description string.
      java.lang.String getShortName()
      Returns the basic one-word name, not case-sensitive, for use in command-line interfaces.
      java.lang.String getStringUsage()
      Returns a usage string which should some clue how to specify this key from a string.
      java.lang.String getXmlDescription()
      Returns an XML string suitable for insertion into a user document.
      ConfigMeta setShortDescription​(java.lang.String shortDescription)
      Sets a short description string.
      ConfigMeta setStringUsage​(java.lang.String usage)
      Sets a usage string which should give some clue how to specify this key from a string.
      ConfigMeta setXmlDescription​(java.lang.String xmlDescription)
      Sets a documentation string.
      ConfigMeta setXmlDescription​(java.lang.String[] lines)
      Convenience method to set the XML description from an array of text lines.
      • Methods inherited from class java.lang.Object

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

      • ConfigMeta

        public ConfigMeta​(java.lang.String shortName,
                          java.lang.String longName)
        Constructor.
        Parameters:
        shortName - basic name, no spaces, not case-sensitive, to be used in command-line interface
        longName - name for use in GUI
    • Method Detail

      • getShortName

        public java.lang.String getShortName()
        Returns the basic one-word name, not case-sensitive, for use in command-line interfaces.
        Returns:
        short name
      • getLongName

        public java.lang.String getLongName()
        Returns a potentially more descriptive name suitable for use in a GUI.
        Returns:
        long name
      • getStringUsage

        public java.lang.String getStringUsage()
        Returns a usage string which should some clue how to specify this key from a string.

        Examples might be something like "true|false" or "<RRGGBB>".

        Returns:
        usage string
      • getShortDescription

        public java.lang.String getShortDescription()
        Returns a short description string.
        Returns:
        one-line description
      • getXmlDescription

        public java.lang.String getXmlDescription()
        Returns an XML string suitable for insertion into a user document. It should be a sequence of one or more <p> elements.
        Returns:
        XML string
      • setStringUsage

        public ConfigMeta setStringUsage​(java.lang.String usage)
        Sets a usage string which should give some clue how to specify this key from a string.

        Examples might be something like "true|false" or "<RRGGBB>".

        Parameters:
        usage - usage string
        Returns:
        this object, as a convenience
      • setShortDescription

        public ConfigMeta setShortDescription​(java.lang.String shortDescription)
        Sets a short description string. This may be used as a prompt on the command line or a tooltip in a GUI. It should preferably be no longer than about 40 characters.
        Parameters:
        shortDescription - one-line description
        Returns:
        this object, as a convenience
      • setXmlDescription

        public ConfigMeta setXmlDescription​(java.lang.String xmlDescription)
        Sets a documentation string. This is written in XML, intended for presentation as user documentation. The whole thing should be one or more <p> elements.

        Permissible elements include p, ul, li, dl, dt, dd, em, code, strong. Lists go inside paragraphs.

        Returns:
        documentation string
      • setXmlDescription

        public ConfigMeta setXmlDescription​(java.lang.String[] lines)
        Convenience method to set the XML description from an array of text lines. setXmlDescription is called on the result of joining the lines with newline characters.
        Parameters:
        lines - lines of documentation string
        Returns:
        this object, as a convenience
      • appendXmlDescription

        public ConfigMeta appendXmlDescription​(java.lang.String[] moreXml)
        Convenience method to add additional lines to the existing XML documentation string.
        Parameters:
        moreXml - additinoal lines of documentation string
        Returns:
        this object, as a convenience
      • capitalise

        public static java.lang.String capitalise​(java.lang.String word)
        Uppercases the first letter of a string.
        Parameters:
        word - word
        Returns:
        word with first letter capitalised if possible