snaq.util.jclap
Class StringOption

java.lang.Object
  extended by snaq.util.jclap.Option<java.lang.String>
      extended by snaq.util.jclap.StringOption

public class StringOption
extends Option<java.lang.String>

Implementation of an Option with value of type String.

Author:
Giles Winstanley

Nested Class Summary
static class StringOption.FileFilter
          Implementation of an StringOption.Filter which filters based on existence and type of file to which the string refers.
static interface StringOption.Filter
          Acceptance filter for StringOption instances.
 
Constructor Summary
StringOption(java.lang.String shortName, java.lang.String longName, java.lang.String description, boolean mandatory, boolean allowMany)
          Creates a new StringOption instance.
StringOption(java.lang.String shortName, java.lang.String longName, java.lang.String description, int minCount, int maxCount)
          Creates a new StringOption instance.
 
Method Summary
 StringOption.Filter getFilter()
          Returns the StringOption.Filter for this instance.
 java.lang.Class<java.lang.String> getType()
          Returns the class type of value this option can take.
 void setFilter(StringOption.Filter filter)
          Sets the StringOption.Filter for this instance.
 
Methods inherited from class snaq.util.jclap.Option
equals, getDescription, getLongName, getMaxCount, getMinCount, getShortName, getValues, hashCode, isAllowMany, isHidden, isMandatory, requiresValue, setHidden, setMinMaxCounts, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringOption

public StringOption(java.lang.String shortName,
                    java.lang.String longName,
                    java.lang.String description,
                    int minCount,
                    int maxCount)
Creates a new StringOption instance.

Parameters:
shortName - short name of the option (e.g. -n)
longName - long name of the option (e.g. --name)
description - helpful description of the option (printed for usage message)
minCount - minimum number of occurrences required for this option
maxCount - maximum number of occurrences required for this option

StringOption

public StringOption(java.lang.String shortName,
                    java.lang.String longName,
                    java.lang.String description,
                    boolean mandatory,
                    boolean allowMany)
Creates a new StringOption instance.

Parameters:
shortName - short name of the option (e.g. -n)
longName - long name of the option (e.g. --name)
description - helpful description of the option (printed for usage message)
mandatory - whether this option must be specified
allowMany - whether this option can take more than one value (i.e. be specified more than once)
Method Detail

setFilter

public void setFilter(StringOption.Filter filter)
Sets the StringOption.Filter for this instance.

Parameters:
filter - Filter instance to use for accepting/rejecting values

getFilter

public StringOption.Filter getFilter()
Returns the StringOption.Filter for this instance.


getType

public java.lang.Class<java.lang.String> getType()
Description copied from class: Option
Returns the class type of value this option can take.

Specified by:
getType in class Option<java.lang.String>