CLOptionDescriptorpublic final class CLOptionDescriptor extends Object Basic class describing an type of option.
Typically, one creates a static array of CLOptionDescriptor s,
and passes it to {@link CLArgsParser#CLArgsParser(String[], CLOptionDescriptor[])}. |
Fields Summary |
---|
public static final int | ARGUMENT_REQUIREDFlag to say that one argument is required | public static final int | ARGUMENT_OPTIONALFlag to say that the argument is optional | public static final int | ARGUMENT_DISALLOWEDFlag to say this option does not take arguments | public static final int | ARGUMENTS_REQUIRED_2Flag to say this option requires 2 arguments | public static final int | DUPLICATES_ALLOWEDFlag to say this option may be repeated on the command line | private final int | m_id | private final int | m_flags | private final String | m_name | private final String | m_description | private final int[] | m_incompatible |
Constructors Summary |
---|
public CLOptionDescriptor(String name, int flags, int id, String description)Constructor.
this( name, flags, id, description,
((flags & CLOptionDescriptor.DUPLICATES_ALLOWED) > 0)
? new int[] {}
: new int[] { id } );
| public CLOptionDescriptor(String name, int flags, int id, String description, int[] incompatable)Constructor.
m_id = id;
m_name = name;
m_flags = flags;
m_description = description;
m_incompatible = incompatable;
|
Methods Summary |
---|
public final java.lang.String | getDescription()Retrieve textual description.
return m_description;
| public final int | getFlags()Retrieve flags about option.
Flags include details such as whether it allows parameters etc.
return m_flags;
| public final int | getId()Retrieve the id for option.
The id is also the character if using single character options.
return m_id;
| protected final int[] | getIncompatble()
return getIncompatible();
| protected final int[] | getIncompatible()
return m_incompatible;
| public final java.lang.String | getName()Retrieve name of option which is also text for long option.
return m_name;
| public final java.lang.String | toString()Convert to String.
return
new StringBuffer()
.append("[OptionDescriptor ").append(m_name)
.append(", ").append(m_id).append(", ").append(m_flags)
.append(", ").append(m_description).append(" ]").toString();
|
|