org.databene.benerator.wrapper
Class SingleSourceArrayGenerator<S,P>

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,P>
All Implemented Interfaces:
java.io.Closeable, Generator<P>, NonNullGenerator<P>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
Direct Known Subclasses:
ByteArrayGenerator, SimplifyingSingleSourceArrayGenerator

public class SingleSourceArrayGenerator<S,P>
extends CardinalGenerator<S,P>
implements NonNullGenerator<P>

Assembles the output of a source generator into an array of random length.

Created: 26.08.2006 09:37:55

Since:
0.1
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
SingleSourceArrayGenerator(Generator<S> source, java.lang.Class<S> componentType, int minLength, int maxLength, Distribution lengthDistribution)
           
SingleSourceArrayGenerator(Generator<S> source, java.lang.Class<S> componentType, NonNullGenerator<java.lang.Integer> lengthGenerator)
           
 
Method Summary
 P generate()
           
 ProductWrapper<P> generate(ProductWrapper<P> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 java.lang.Class<P> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 
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

SingleSourceArrayGenerator

public SingleSourceArrayGenerator(Generator<S> source,
                                  java.lang.Class<S> componentType,
                                  int minLength,
                                  int maxLength,
                                  Distribution lengthDistribution)

SingleSourceArrayGenerator

public SingleSourceArrayGenerator(Generator<S> source,
                                  java.lang.Class<S> componentType,
                                  NonNullGenerator<java.lang.Integer> lengthGenerator)
Method Detail

getGeneratedType

public java.lang.Class<P> getGeneratedType()
Description copied from interface: Generator
Declares the type of the objects returned by the generate() method.

Specified by:
getGeneratedType in interface Generator<P>

generate

public ProductWrapper<P> generate(ProductWrapper<P> 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<P>

generate

public P generate()
Specified by:
generate in interface NonNullGenerator<P>


Copyright © 2013. All Rights Reserved.