pl.kernelpanic.dbmonster.generator
Class DateTimeGenerator

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

public class DateTimeGenerator
extends BasicDataGenerator
implements Initializable

The generator which prouces dates.

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

Field Summary
static int DATE
          Returned type should be date.
static SimpleDateFormat DATE_FORMAT
          Date format.
static int TIME
          Returned type should be time.
static int TIMESTAMP
          Returned type should be timestamp.
 
Fields inherited from class pl.kernelpanic.dbmonster.generator.BasicDataGenerator
column, nulls
 
Constructor Summary
DateTimeGenerator()
           
 
Method Summary
 Object generate()
          Generates random date or time.
 String getEndDate()
          Returns the end date.
 String getReturnedType()
          Returns type.
 String getStartDate()
          Returns start Date.
 void initialize(DBMonsterContext ctx)
          Initializes the generator.
 void reset()
          Resets the generator.
 void setEndDate(String end)
          Sets the end date.
 void setReturnedType(String type)
          Sets the returned type.
 void setStartDate(String start)
          Sets the start date.
 
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
 

Field Detail

DATE

public static final int DATE
Returned type should be date.

See Also:
Constant Field Values

TIME

public static final int TIME
Returned type should be time.

See Also:
Constant Field Values

TIMESTAMP

public static final int TIMESTAMP
Returned type should be timestamp.

See Also:
Constant Field Values

DATE_FORMAT

public static final SimpleDateFormat DATE_FORMAT
Date format.

Constructor Detail

DateTimeGenerator

public DateTimeGenerator()
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 - if generator contains errors.

generate

public final Object generate()
Generates random date or time.

Specified by:
generate in interface DataGenerator
Returns:
value.

getStartDate

public final String getStartDate()
Returns start Date.

Returns:
start date

setStartDate

public final void setStartDate(String start)
                        throws Exception
Sets the start date.

Parameters:
start - start date
Throws:
Exception - on errors

getEndDate

public final String getEndDate()
Returns the end date.

Returns:
end date

setEndDate

public final void setEndDate(String end)
                      throws Exception
Sets the end date.

Parameters:
end - end date
Throws:
Exception - on errors

getReturnedType

public final String getReturnedType()
Returns type.

Returns:
string representation of returned time

setReturnedType

public final void setReturnedType(String type)
Sets the returned type.

Parameters:
type - type

reset

public final void reset()
Resets the generator.

Specified by:
reset in interface DataGenerator


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