org.databene.benerator.composite
Class SimplifyingSingleSourceArrayGenerator<S>

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.GeneratorWrapper<S,P>
          extended by org.databene.benerator.wrapper.CardinalGenerator<S,P>
              extended by org.databene.benerator.wrapper.SingleSourceArrayGenerator<S,java.lang.Object>
                  extended by org.databene.benerator.composite.SimplifyingSingleSourceArrayGenerator<S>
All Implemented Interfaces:
java.io.Closeable, Generator<java.lang.Object>, NonNullGenerator<java.lang.Object>, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class SimplifyingSingleSourceArrayGenerator<S>
extends SingleSourceArrayGenerator<S,java.lang.Object>

Creates a stochastic number of instances of a type. The number of elements is determined by the values minCount, maxCount, countDistribution. If the number of items is not one, an array of respective size is returned, otherwise a single object.

Created: 06.03.2008 15:43:54

Since:
0.5.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.wrapper.CardinalGenerator
cardinalGenerator
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
SimplifyingSingleSourceArrayGenerator(Generator<S> source, NonNullGenerator<java.lang.Integer> countGenerator)
           
 
Method Summary
 ProductWrapper<java.lang.Object> generate(ProductWrapper<java.lang.Object> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 
Methods inherited from class org.databene.benerator.wrapper.SingleSourceArrayGenerator
generate, getGeneratedType
 
Methods inherited from class org.databene.benerator.wrapper.CardinalGenerator
generateCardinal, generateCardinalWrapper, init, reset
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
close, equals, generateFromSource, getSource, getSourceWrapper, hashCode, isParallelizable, isThreadSafe, setSource, toString
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, getResultWrapper, wasInitialized
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.databene.benerator.Generator
close, init, wasInitialized
 
Methods inherited from interface org.databene.commons.ThreadAware
isParallelizable, isThreadSafe
 
Methods inherited from interface org.databene.commons.Resettable
reset
 

Constructor Detail

SimplifyingSingleSourceArrayGenerator

public SimplifyingSingleSourceArrayGenerator(Generator<S> source,
                                             NonNullGenerator<java.lang.Integer> countGenerator)
Method Detail

generate

public ProductWrapper<java.lang.Object> generate(ProductWrapper<java.lang.Object> wrapper)
Description copied from interface: Generator
Returns an instance of the generic type E, using the ProductWrapper 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.

Specified by:
generate in interface Generator<java.lang.Object>
Overrides:
generate in class SingleSourceArrayGenerator<S,java.lang.Object>


Copyright © 2013. All Rights Reserved.