pl.kernelpanic.dbmonster.generator
Class StringGenerator

java.lang.Object
  extended bypl.kernelpanic.dbmonster.generator.BasicDataGenerator
      extended bypl.kernelpanic.dbmonster.generator.StringGenerator
All Implemented Interfaces:
DataGenerator, Initializable

public class StringGenerator
extends BasicDataGenerator
implements Initializable

String generator. Recognizes the following properties:

minLength minimal length of generated string (default: 0)
maxLength maximum length of generated string (default: 255)
allowSpaces should this column contain spaces? (default: true)
excludeChars characters that should not appear in generated string (no default value)
nulls How many nulls on average should this generator produce per every 100 rows (default: 0)

Version:
$Id: StringGenerator.html,v 1.1 2007/06/21 08:38:14 sbahloul Exp $
Author:
Piotr Maj <piotr.maj@kernelpanic.pl>

Field Summary
 
Fields inherited from class pl.kernelpanic.dbmonster.generator.BasicDataGenerator
column, nulls
 
Constructor Summary
StringGenerator()
           
 
Method Summary
 Object generate()
          Generates random string.
 boolean getAllowSpaces()
          Return allowSpaces parameter.
 String getExcludeChars()
          Returns an exclude chars.
 int getMaxLength()
          Returns the maximal length of the string.
 int getMinLength()
          Returns the minimal length of the string.
 void initialize(DBMonsterContext ctx)
          Initializes the generator.
 void reset()
          Resets the generator.
 void setAllowSpaces(boolean spaces)
          Sets the allowSpaces parameter.
 void setExcludeChars(String chars)
          Sets the excluded characters.
 void setMaxLength(int length)
          Sets the maximal length of the string.
 void setMinLength(int length)
          Sets the minimal length of the string.
 
Methods inherited from class pl.kernelpanic.dbmonster.generator.BasicDataGenerator
getColumn, getNulls, setColumn, setNulls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringGenerator

public StringGenerator()
Method Detail

initialize

public final void initialize(DBMonsterContext ctx)
                      throws Exception
Initializes the generator.

Specified by:
initialize in interface Initializable
Parameters:
ctx - context
Throws:
Exception - of errors

generate

public final Object generate()
Generates random string.

Specified by:
generate in interface DataGenerator
Returns:
null.

getMinLength

public final int getMinLength()
Returns the minimal length of the string.

Returns:
the minimal length of generated string

setMinLength

public final void setMinLength(int length)
Sets the minimal length of the string.

Parameters:
length - minimal length

getMaxLength

public final int getMaxLength()
Returns the maximal length of the string.

Returns:
the maximal value of generated string

setMaxLength

public final void setMaxLength(int length)
Sets the maximal length of the string.

Parameters:
length - maximal length

getAllowSpaces

public final boolean getAllowSpaces()
Return allowSpaces parameter.

Returns:
true if generated string can contain spaces.

setAllowSpaces

public final void setAllowSpaces(boolean spaces)
Sets the allowSpaces parameter.

Parameters:
spaces - true or false

getExcludeChars

public final String getExcludeChars()
Returns an exclude chars.

Returns:
characters that should not be included in generated string.

setExcludeChars

public final void setExcludeChars(String chars)
Sets the excluded characters.

Parameters:
chars - the characters to exclude

reset

public final void reset()
Resets the generator.

Specified by:
reset in interface DataGenerator


Copyright © 2003-2005 .:. kernelpanic.pl .:.. All Rights Reserved.