Class BaseOption

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseOption​(java.lang.String name, java.lang.String shortNames, java.lang.String metaVar, java.lang.String usage, java.lang.String defaultValue, boolean repeated, boolean required, boolean hidden)  
    • Constructor Detail

      • BaseOption

        protected BaseOption​(java.lang.String name,
                             java.lang.String shortNames,
                             java.lang.String metaVar,
                             java.lang.String usage,
                             java.lang.String defaultValue,
                             boolean repeated,
                             boolean required,
                             boolean hidden)
    • Method Detail

      • getShortNames

        public java.lang.String getShortNames()
        Each character of the shortNames string is handled as a short option that is parsed with the -[short] style. If the string is empty or null, no short options are provided.
        Returns:
        The short names
      • getMetaVar

        public java.lang.String getMetaVar()
        Meta variable to show in usage printout.
        Returns:
        The meta variable.
      • getSingleLineUsage

        public java.lang.String getSingleLineUsage()
        Description copied from class: BaseArgument
        Get the argument's single line usage string.
        Specified by:
        getSingleLineUsage in class BaseArgument
        Returns:
        The single-line usage string.
      • getPrefix

        public java.lang.String getPrefix()
        Description copied from class: BaseArgument
        Prefix part of the usage usage message.
        Specified by:
        getPrefix in class BaseArgument
        Returns:
        The usage prefix.
      • applyShort

        public abstract int applyShort​(java.lang.String opts,
                                       ArgumentList args)
        When handling a list of short options, except for the last short option.
        Parameters:
        opts - The remaining characters of the short opt list.
        args - The list of arguments including the short opt list.
        Returns:
        The number of arguments consumed. If 0 is returned, will handle as the short option char was the only thing being consumed.
      • apply

        public abstract int apply​(ArgumentList args)
        Parse the argument list, including the argument string that triggered the call. And handle it's value or values.
        Specified by:
        apply in class BaseArgument
        Parameters:
        args - The list of arguments.
        Returns:
        The number of arguments consumed.
        Throws:
        ArgumentException - If the passed arguments are not valid.
      • nameOrShort

        protected java.lang.String nameOrShort()
        Handy getter mostly to be used in exception naming.
        Returns:
        The argument's name or first short name.