org.hyphenType.datastructure.annotations
Annotation Type OptionArgument


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface OptionArgument

Author:
Aurelio Akira M. Matsui

Required Element Summary
 String option
           
 
Optional Element Summary
 InputChannel[] channels
           
 String description
           
 int index
          The index of this option argument.
 boolean mandatory
           
 String name
           
 String regex
          Regular expression that a string should match in order to be accepted as this argument.
 

Element Detail

option

public abstract String option

name

public abstract String name
Default:
""

index

public abstract int index
The index of this option argument. Each option argument should have a unique index. Indexes should be a sequence in the form 0, 1, ...

This property has 0 as the default value to keep the code clean when there is only one argument.

But it is not advisable to omit the index when using more than one option argument since it is harder to read. This is a counter example:
 @OptionArgument(option="a")
 String arg1();
 
 @OptionArgument(option="a", index=1)
 String arg2();
 
The following is more readable:
 @OptionArgument(option="a", index=0)
 String arg1();
 
 @OptionArgument(option="a", index=1)
 String arg2();
 

Returns:
The index of this option argument.
Default:
0

regex

public abstract String regex
Regular expression that a string should match in order to be accepted as this argument. Default value will accept anything that does not start with a single or a double hyphen. When you write a regex, you can refer to the single hyphen as \h and the double hyphen as \H. Therefore, the default regex is "[^\Q\h\E&^\Q\H\E].*".

Note that single and double hyphens are, respectively, the strings "-" and "--", but these strings can be changed through the properties ArgumentsObject.singleHyphen() and ArgumentsObject.doubleHyphen().

Default:
"[^\\Q\\h\\E&^\\Q\\H\\E].*"

channels

public abstract InputChannel[] channels
Default:
org.hyphenType.datastructure.annotations.InputChannel.ARGUMENT

mandatory

public abstract boolean mandatory
Default:
false

description

public abstract String description
Default:
""


Copyright © 2013. All Rights Reserved.