net.sf.xaj.support
Class RandomStringParametersResolver

java.lang.Object
  extended by net.sf.xaj.support.AbstractSimpleParametersResolver
      extended by net.sf.xaj.support.RandomStringParametersResolver
All Implemented Interfaces:
XAttack.IterationParametersResolver

public class RandomStringParametersResolver
extends AbstractSimpleParametersResolver

Resolve a random String value of a specific length.

This resolver will geneate a Map with a single String property constructed from random characters from within a character range between minChar and maxChar. If the onlyAlphaNumeric property is tru then only alpha-numeric characters will be generated. The length of the generated String is determined by the numChars property.

The configurable properties of this class are:

numChars
The desired lenght of the generated String.
minChar
The minimum character to use. Defauts to 0.
maxChar
The maximum character to use. Defaults to z.
onlyAlphaNumeric
If true then use Character.isLetterOrDigit(char) to only add characters which evaluate to true. Defaults to true.

Version:
$Revision: 51 $ $Date: 2007-10-09 19:04:12 +1300 (Tue, 09 Oct 2007) $
Author:
matt

Field Summary
static java.lang.String DEFAULT_PARAM_NAME
          The default value for the paramName property.
 
Constructor Summary
RandomStringParametersResolver()
          Default constructor.
 
Method Summary
 char getMaxChar()
           
 char getMinChar()
           
 int getNumChars()
           
 void init()
          Initialize for use.
 boolean isOnlyAlphaNumeric()
           
 java.util.Map<java.lang.String,?> resolveParameters(int iteration)
          Resolve the parameters for a given iteration.
 void setMaxChar(char maxChar)
           
 void setMinChar(char minChar)
           
 void setNumChars(int numChars)
           
 void setOnlyAlphaNumeric(boolean onlyAlphaNumeric)
           
 
Methods inherited from class net.sf.xaj.support.AbstractSimpleParametersResolver
getParamName, resolveSimpleMap, resolveSimpleMap, setParamName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PARAM_NAME

public static final java.lang.String DEFAULT_PARAM_NAME
The default value for the paramName property.

See Also:
Constant Field Values
Constructor Detail

RandomStringParametersResolver

public RandomStringParametersResolver()
Default constructor.

Method Detail

init

public void init()
Initialize for use.


resolveParameters

public java.util.Map<java.lang.String,?> resolveParameters(int iteration)
Description copied from interface: XAttack.IterationParametersResolver
Resolve the parameters for a given iteration.

Parameters:
iteration - the iteration count
Returns:
Map of parameter values

getMaxChar

public char getMaxChar()
Returns:
the maxChar

setMaxChar

public void setMaxChar(char maxChar)
Parameters:
maxChar - the maxChar to set

getMinChar

public char getMinChar()
Returns:
the minChar

setMinChar

public void setMinChar(char minChar)
Parameters:
minChar - the minChar to set

getNumChars

public int getNumChars()
Returns:
the numChars

setNumChars

public void setNumChars(int numChars)
Parameters:
numChars - the numChars to set

isOnlyAlphaNumeric

public boolean isOnlyAlphaNumeric()
Returns:
the onlyAlphaNumeric

setOnlyAlphaNumeric

public void setOnlyAlphaNumeric(boolean onlyAlphaNumeric)
Parameters:
onlyAlphaNumeric - the onlyAlphaNumeric to set