net.sf.mmm.util.cli.api
Enum CliContainerStyle

java.lang.Object
  extended by java.lang.Enum<CliContainerStyle>
      extended by net.sf.mmm.util.cli.api.CliContainerStyle
All Implemented Interfaces:
Serializable, Comparable<CliContainerStyle>

public enum CliContainerStyle
extends Enum<CliContainerStyle>

This enum contains the available styles for container types. A container type is an array, Map or Collection.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
CliStyle.containerStyle(), CliOption.containerStyle(), CliArgument.containerStyle()

Enum Constant Summary
COMMA_SEPARATED
          The CliOption or CliArgument may occur only once.
DEFAULT
          The default style that indicates a fallback to the CliStyle.containerStyle().
MULTIPLE_OCCURRENCE
          The CliOption or CliArgument may occur multiple times.
 
Method Summary
static CliContainerStyle valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CliContainerStyle[] 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

DEFAULT

public static final CliContainerStyle DEFAULT
The default style that indicates a fallback to the CliStyle.containerStyle().


MULTIPLE_OCCURRENCE

public static final CliContainerStyle MULTIPLE_OCCURRENCE
The CliOption or CliArgument may occur multiple times. The collection gets filled with all these values in the order of their occurrence. This style is the default. For arguments this style is only allowed for the last CliArgument.
Example:
Assuming we have a CLI program called Foo with a property private List listProperty annotated with a CliOption named --list and with this style via CliOption.containerStyle(). It may also have another boolean option named --bar. Now we call the program like this:
 Foo --list first --bar --list "second value" --list 3
 
So listProperty will be filled with a List containing {"first", "second value", "3"}.


COMMA_SEPARATED

public static final CliContainerStyle COMMA_SEPARATED
The CliOption or CliArgument may occur only once. Multiple values are supplied as comma separated list. In the above example call the program as following:
 Foo --list "first,second value,3" --bar
 

See Also:
AbstractValueConverterToContainer
Method Detail

values

public static CliContainerStyle[] 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 (CliContainerStyle c : CliContainerStyle.values())
    System.out.println(c);

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

valueOf

public static CliContainerStyle valueOf(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2001-2010 mmm-Team. All Rights Reserved.