org.databene.benerator.wrapper
Class SingleSourceCollectionGenerator<I,C extends java.util.Collection<I>>

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<I,C>
              extended by org.databene.benerator.wrapper.SingleSourceCollectionGenerator<I,C>
All Implemented Interfaces:
java.io.Closeable, Generator<C>, NonNullGenerator<C>, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class SingleSourceCollectionGenerator<I,C extends java.util.Collection<I>>
extends CardinalGenerator<I,C>
implements NonNullGenerator<C>

Generator which takes one or more products from a source generator and wraps them with a Collection.

Created: 24.02.2012 19:52:24

Since:
0.7.6
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
SingleSourceCollectionGenerator(Generator<I> source, java.lang.Class<C> collectionType, NonNullGenerator<java.lang.Integer> lengthGenerator)
           
 
Method Summary
 C generate()
           
 ProductWrapper<C> generate(ProductWrapper<C> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 java.lang.Class<C> 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

SingleSourceCollectionGenerator

public SingleSourceCollectionGenerator(Generator<I> source,
                                       java.lang.Class<C> collectionType,
                                       NonNullGenerator<java.lang.Integer> lengthGenerator)
Method Detail

getGeneratedType

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

Specified by:
getGeneratedType in interface Generator<C extends java.util.Collection<I>>

generate

public ProductWrapper<C> generate(ProductWrapper<C> 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<C extends java.util.Collection<I>>

generate

public C generate()
Specified by:
generate in interface NonNullGenerator<C extends java.util.Collection<I>>


Copyright © 2013. All Rights Reserved.