Class DateTimeGenerator
- java.lang.Object
-
- com.rapiddweller.benerator.util.AbstractGenerator<E>
-
- com.rapiddweller.benerator.wrapper.CompositeGenerator<java.util.Date>
-
- com.rapiddweller.benerator.primitive.datetime.DateTimeGenerator
-
- All Implemented Interfaces:
Generator<java.util.Date>
,NonNullGenerator<java.util.Date>
,com.rapiddweller.common.Resettable
,com.rapiddweller.common.ThreadAware
,java.io.Closeable
,java.lang.AutoCloseable
public class DateTimeGenerator extends CompositeGenerator<java.util.Date> implements NonNullGenerator<java.util.Date>
Creates DateTimes with separate date and time distribution characteristics.
Created: 29.02.2008 18:19:55- Since:
- 0.5.0
- Author:
- Volker Bergmann
-
-
Field Summary
-
Fields inherited from class com.rapiddweller.benerator.wrapper.CompositeGenerator
components, generatedType
-
Fields inherited from class com.rapiddweller.benerator.util.AbstractGenerator
context, logger, state
-
-
Constructor Summary
Constructors Constructor Description DateTimeGenerator()
Instantiates a new Date time generator.DateTimeGenerator(java.util.Date minDate, java.util.Date maxDate, java.sql.Time minTime, java.sql.Time maxTime)
Instantiates a new Date time generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Date
generate()
Generate e.ProductWrapper<java.util.Date>
generate(ProductWrapper<java.util.Date> wrapper)
Returns an instance of the generic type E, using theProductWrapper
instance provided as argument.void
init(GeneratorContext context)
Init.void
setDateDistribution(Distribution distribution)
Sets date distribution.void
setDateGranularity(java.lang.String dateGranularity)
Sets date granularity.void
setMaxDate(java.util.Date maxDate)
Sets max date.void
setMaxTime(java.sql.Time maxTime)
Sets max time.void
setMinDate(java.util.Date minDate)
Sets min date.void
setMinTime(java.sql.Time minTime)
Sets min time.void
setTimeDistribution(Distribution distribution)
Sets time distribution.void
setTimeGranularity(java.sql.Time timeGranularity)
Sets time granularity.-
Methods inherited from class com.rapiddweller.benerator.wrapper.CompositeGenerator
getGeneratedType, isParallelizable, isThreadSafe, registerComponent, registerComponents
-
Methods inherited from class com.rapiddweller.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, close, getResultWrapper, reset, toString, wasInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.rapiddweller.benerator.Generator
close, getGeneratedType, wasInitialized
-
-
-
-
Constructor Detail
-
DateTimeGenerator
public DateTimeGenerator()
Instantiates a new Date time generator.
-
DateTimeGenerator
public DateTimeGenerator(java.util.Date minDate, java.util.Date maxDate, java.sql.Time minTime, java.sql.Time maxTime)
Instantiates a new Date time generator.- Parameters:
minDate
- the min datemaxDate
- the max dateminTime
- the min timemaxTime
- the max time
-
-
Method Detail
-
setMinDate
public void setMinDate(java.util.Date minDate)
Sets min date.- Parameters:
minDate
- the min date
-
setMaxDate
public void setMaxDate(java.util.Date maxDate)
Sets max date.- Parameters:
maxDate
- the max date
-
setDateGranularity
public void setDateGranularity(java.lang.String dateGranularity)
Sets date granularity.- Parameters:
dateGranularity
- the date granularity
-
setDateDistribution
public void setDateDistribution(Distribution distribution)
Sets date distribution.- Parameters:
distribution
- the distribution
-
setMinTime
public void setMinTime(java.sql.Time minTime)
Sets min time.- Parameters:
minTime
- the min time
-
setMaxTime
public void setMaxTime(java.sql.Time maxTime)
Sets max time.- Parameters:
maxTime
- the max time
-
setTimeGranularity
public void setTimeGranularity(java.sql.Time timeGranularity)
Sets time granularity.- Parameters:
timeGranularity
- the time granularity
-
setTimeDistribution
public void setTimeDistribution(Distribution distribution)
Sets time distribution.- Parameters:
distribution
- the distribution
-
init
public void init(GeneratorContext context)
Description copied from interface:Generator
Init.- Specified by:
init
in interfaceGenerator<java.util.Date>
- Overrides:
init
in classAbstractGenerator<java.util.Date>
- Parameters:
context
- the context
-
generate
public ProductWrapper<java.util.Date> generate(ProductWrapper<java.util.Date> wrapper)
Description copied from interface:Generator
Returns an instance of the generic type E, using theProductWrapper
instance provided as argument. The wrapper may wrap a null value as a regular generator product. If the generator is not available (any more), it returns null instead of the ProductWrapper instance.
-
generate
public java.util.Date generate()
Description copied from interface:NonNullGenerator
Generate e.- Specified by:
generate
in interfaceNonNullGenerator<java.util.Date>
- Returns:
- the e
-
-