bcds.tools
Enum ArgsParserException.ErrorCode

java.lang.Object
  extended by java.lang.Enum<ArgsParserException.ErrorCode>
      extended by bcds.tools.ArgsParserException.ErrorCode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ArgsParserException.ErrorCode>
Enclosing class:
ArgsParserException

public static enum ArgsParserException.ErrorCode
extends java.lang.Enum<ArgsParserException.ErrorCode>

Lists the error codes that ArgsParser can include in an ArgsParserException as an indication of the cause of the error.


Enum Constant Summary
ARG_EXPECTED
          There is a missing argument for a non-boolean option.
BAD_ENUM
          An option's argument does not belong to the given enumeration.
BAD_OPTION_ID
          The option requested does not exist, generally caused by a programming error.
BAD_USAGE
          A generic exception, never raised from within ArgsParser.
BAD_VALUE
          The option's argument cannot be converted to the requested type.
FILE_IO
          IO error reading a file (for example, when reading options).
GENERIC
          A catch-all error code, generally used to indicate programming error.
NON_UNIQUE_OPTION
          The option (as given by the user) appears more than once.
UNREGISTERED_OPTION
          The user-provided argument is unknown, that is, the programmer did not "register" such option (the option does not exist).
 
Method Summary
static ArgsParserException.ErrorCode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ArgsParserException.ErrorCode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BAD_OPTION_ID

public static final ArgsParserException.ErrorCode BAD_OPTION_ID
The option requested does not exist, generally caused by a programming error.


UNREGISTERED_OPTION

public static final ArgsParserException.ErrorCode UNREGISTERED_OPTION
The user-provided argument is unknown, that is, the programmer did not "register" such option (the option does not exist). It is a "usage" error.


BAD_VALUE

public static final ArgsParserException.ErrorCode BAD_VALUE
The option's argument cannot be converted to the requested type. That happens for example when applying getInt("opt") when the value was given as --opt=abc.


BAD_ENUM

public static final ArgsParserException.ErrorCode BAD_ENUM
An option's argument does not belong to the given enumeration.


ARG_EXPECTED

public static final ArgsParserException.ErrorCode ARG_EXPECTED
There is a missing argument for a non-boolean option.


NON_UNIQUE_OPTION

public static final ArgsParserException.ErrorCode NON_UNIQUE_OPTION
The option (as given by the user) appears more than once.


BAD_USAGE

public static final ArgsParserException.ErrorCode BAD_USAGE
A generic exception, never raised from within ArgsParser. It is intended for the user (generally main) that can check and detect semantic errors (for example).


FILE_IO

public static final ArgsParserException.ErrorCode FILE_IO
IO error reading a file (for example, when reading options).


GENERIC

public static final ArgsParserException.ErrorCode GENERIC
A catch-all error code, generally used to indicate programming error.

Method Detail

values

public static ArgsParserException.ErrorCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ArgsParserException.ErrorCode c : ArgsParserException.ErrorCode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ArgsParserException.ErrorCode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null