Class InvalidValueException

  • All Implemented Interfaces:
    Serializable

    public class InvalidValueException
    extends CLIException
    Exception thrown when an option or an argument receives an invalid value.
    Author:
    Clement Escoffier
    See Also:
    Serialized Form
    • Constructor Detail

      • InvalidValueException

        public InvalidValueException​(Option option,
                                     String value)
        Creates a new instance of InvalidValueException for the given option and the given value. This constructor is used when the option receives a value while it does not accept another value.
        Parameters:
        option - the option
        value - the value
      • InvalidValueException

        public InvalidValueException​(Argument argument,
                                     String value,
                                     Exception cause)
        Creates a new instance of InvalidValueException for the given argument and the given value. This constructor is used when the argument receives a value that cannot be "converted" to the desired type.
        Parameters:
        argument - the argument
        value - the value
        cause - the cause
      • InvalidValueException

        public InvalidValueException​(Option option,
                                     String value,
                                     Exception cause)
        Creates a new instance of InvalidValueException for the given option and the given value. This constructor is used when the options receives a value that cannot be "converted" to the desired type.
        Parameters:
        option - the option
        value - the value
        cause - the cause
    • Method Detail

      • getOption

        public Option getOption()
        Returns:
        the option, may be null if the exception is about an argument.
      • getValue

        public String getValue()
        Returns:
        the invalid value.
      • getArgument

        public Argument getArgument()
        Returns:
        the argument, may be null if the exception is about an option.