org.vivoweb.harvester.util.args
Class ArgDef

java.lang.Object
  extended by org.vivoweb.harvester.util.args.ArgDef

public class ArgDef
extends java.lang.Object

Defines an Argument

Author:
Christopher Haines (hainesc@ctrip.ufl.edu)

Constructor Summary
ArgDef()
          Default Constructor
 
Method Summary
 java.lang.String getDefaultValue()
          Get the default value
 java.lang.String getDescription()
          Get the argument description
 java.lang.String getLongOption()
          Get the long --Foo type option flag
 java.lang.String getParameterDescription()
          Get the description for this arguments parameter
 java.lang.Character getShortOption()
          Get the short -X type option flag
 boolean hasDefaultValue()
          Does this argument have a parameter with a default value
 boolean hasParameter()
          Does this argument have at least a parameter
 boolean hasParameters()
          Does this argument have many parameters
 boolean isParameterRequired()
          Does this argument require a parameter
 boolean isParameterValueMap()
          Is this argument a value map
 boolean isRequired()
          Is this argument required
 int numParameters()
          Get the number of parameters for this argument
 ArgDef setDefaultValue(java.lang.String valueDefault)
          Sets the default value
 ArgDef setDescription(java.lang.String description)
          Sets the description of this argument
 ArgDef setLongOpt(java.lang.String longOpt)
          Sets the long --Foo type option flag
 ArgDef setRequired(boolean required)
          Sets this argument as required
 ArgDef setShortOption(char shortOpt)
          Sets the short -X type option flag
 ArgDef withParameter(boolean required, java.lang.String description)
          Set this argument to have a parameter
 ArgDef withParameters(boolean required, java.lang.String description)
          Set this argument to have any number of parameters
 ArgDef withParameters(boolean required, java.lang.String description, int numParams)
          Set this argument to have a set number of parameters
 ArgDef withParameterValueMap(java.lang.String propertyName, java.lang.String valueName)
          Sets this argument to have a value map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgDef

public ArgDef()
Default Constructor

Method Detail

hasParameter

public boolean hasParameter()
Does this argument have at least a parameter

Returns:
true if this argument has at least a parameter

hasParameters

public boolean hasParameters()
Does this argument have many parameters

Returns:
true if this argument has many paramters

numParameters

public int numParameters()
Get the number of parameters for this argument

Returns:
the number of parameters for this argument (-1 is unlimited)

isParameterRequired

public boolean isParameterRequired()
Does this argument require a parameter

Returns:
true if this argument has a parameter and it is required

getParameterDescription

public java.lang.String getParameterDescription()
Get the description for this arguments parameter

Returns:
the description

isParameterValueMap

public boolean isParameterValueMap()
Is this argument a value map

Returns:
true if value map

getShortOption

public java.lang.Character getShortOption()
Get the short -X type option flag

Returns:
the shortOption (null if not set)

getLongOption

public java.lang.String getLongOption()
Get the long --Foo type option flag

Returns:
the longOption (null if not set)

isRequired

public boolean isRequired()
Is this argument required

Returns:
the required

hasDefaultValue

public boolean hasDefaultValue()
Does this argument have a parameter with a default value

Returns:
true if this argument has a parameter with a default value

getDefaultValue

public java.lang.String getDefaultValue()
Get the default value

Returns:
the default value (null if never set)

getDescription

public java.lang.String getDescription()
Get the argument description

Returns:
the description

setShortOption

public ArgDef setShortOption(char shortOpt)
Sets the short -X type option flag

Parameters:
shortOpt - short option value
Returns:
this ArgDef

setLongOpt

public ArgDef setLongOpt(java.lang.String longOpt)
Sets the long --Foo type option flag

Parameters:
longOpt - long option value
Returns:
this ArgDef

setDescription

public ArgDef setDescription(java.lang.String description)
Sets the description of this argument

Parameters:
description - description of this argument
Returns:
this ArgDef

setRequired

public ArgDef setRequired(boolean required)
Sets this argument as required

Parameters:
required - is this argument required
Returns:
this ArgDef

setDefaultValue

public ArgDef setDefaultValue(java.lang.String valueDefault)
Sets the default value

Parameters:
valueDefault - the default value
Returns:
this ArgDef

withParameter

public ArgDef withParameter(boolean required,
                            java.lang.String description)
Set this argument to have a parameter

Parameters:
required - is this parameter required
description - description of the parameter
Returns:
this ArgDef

withParameters

public ArgDef withParameters(boolean required,
                             java.lang.String description)
Set this argument to have any number of parameters

Parameters:
required - is this parameter required
description - description of the parameter
Returns:
this ArgDef

withParameters

public ArgDef withParameters(boolean required,
                             java.lang.String description,
                             int numParams)
Set this argument to have a set number of parameters

Parameters:
required - is this parameter required
description - description of the parameter
numParams - number of parameters
Returns:
this ArgDef

withParameterValueMap

public ArgDef withParameterValueMap(java.lang.String propertyName,
                                    java.lang.String valueName)
Sets this argument to have a value map

Parameters:
propertyName - name of property
valueName - name of value
Returns:
this ArgDef