Class ArgumentWithoutValue

    • Method Detail

      • setExclusive

        public void setExclusive​(boolean exclusive)
      • isExclusive

        public boolean isExclusive()
      • addRequiredPreceding

        public void addRequiredPreceding​(CommandArgument arg)
      • addCantAppearAfter

        public void addCantAppearAfter​(CommandArgument arg)
      • getIndex

        public int getIndex()
        Description copied from interface: CommandArgument
        If the argument doesn't have a name its value can be found by index. Indexes start with 0. A command could have both a name and an index. In that case, the name is optional. If the command doesn't have a fixed index, the method will return -1.
        Specified by:
        getIndex in interface CommandArgument
        Returns:
        the index of the argument.
      • getValue

        public String getValue​(ParsedCommandLine args)
        Description copied from interface: CommandArgument
        Returns the value of the argument specified on the command line. If the argument isn't specified the returned value is null. Although, it might throw IllegalArgumentException in case the argument is a required one.
        Specified by:
        getValue in interface CommandArgument
        Parameters:
        args - parsed arguments.
        Returns:
        the value of the argument or null if the argument isn't present or is missing value.
      • getValue

        public String getValue​(ParsedCommandLine args,
                               boolean required)
                        throws CommandFormatException
        Description copied from interface: CommandArgument
        Returns the value of the argument specified on the command line. If the argument isn't specified and the value is not required null is returned. Otherwise an exception is thrown.
        Specified by:
        getValue in interface CommandArgument
        Parameters:
        args - parsed arguments.
        required - whether the value for this argument is required.
        Returns:
        the value of the argument or null if the argument isn't present and the value is not required.
        Throws:
        CommandFormatException
      • isValueComplete

        public boolean isValueComplete​(ParsedCommandLine args)
                                throws CommandFormatException
        Description copied from interface: CommandArgument
        Checks whether the value is specified and complete. The value is considered complete only if it is followed by a separator (argument separator, end of argument list but not end-of-content).
        Specified by:
        isValueComplete in interface CommandArgument
        Parameters:
        args - the parsed arguments
        Returns:
        true if the value of the argument is complete, false otherwise.
        Throws:
        CommandFormatException
      • getFullName

        public String getFullName()
        Description copied from interface: CommandArgument
        The default name of the argument. An argument can have more than one name, e.g. --force and -f. Full name can't be null.
        Specified by:
        getFullName in interface CommandArgument
        Returns:
        the default name of the argument.
      • canAppearNext

        public boolean canAppearNext​(CommandContext ctx)
                              throws CommandFormatException
        Description copied from interface: CommandArgument
        Checks whether the argument can appear on the command given the already present arguments. (Used for tab-completion. Although, often isValueComplete(ParsedOperationRequest req) would be more appropriate.)
        Specified by:
        canAppearNext in interface CommandArgument
        Returns:
        true if the argument can appear on the command line next, false - otherwise.
        Throws:
        CommandFormatException
      • isValueRequired

        public boolean isValueRequired()
        Description copied from interface: CommandArgument
        Checks whether the argument accepts value.
        Specified by:
        isValueRequired in interface CommandArgument
        Returns:
        true if this argument accepts a value, otherwise false.
      • getShortName

        public String getShortName()
        Description copied from interface: CommandArgument
        Short name of the argument if exists.
        Specified by:
        getShortName in interface CommandArgument
        Returns:
        short name of the argument or null if the short name doesn't exist.
      • setAccessRequirement

        public void setAccessRequirement​(AccessRequirement access)