org.databene.benerator.wrapper
Class SimpleMultiSourceArrayGenerator<S>

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.MultiGeneratorWrapper<S,S[]>
          extended by org.databene.benerator.wrapper.SimpleMultiSourceArrayGenerator<S>
All Implemented Interfaces:
java.io.Closeable, Generator<S[]>, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class SimpleMultiSourceArrayGenerator<S>
extends MultiGeneratorWrapper<S,S[]>

Keeps an array of generators, of which it combines the products to an array.

Created: 26.08.2006 09:37:55

Since:
0.1
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.wrapper.MultiGeneratorWrapper
generatedType, sources
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
SimpleMultiSourceArrayGenerator(java.lang.Class<S> componentType, Generator<? extends S>... sources)
          Initializes the generator to an array of source generators
 
Method Summary
 void close()
          Closes the generator.
 ProductWrapper<S[]> generate(ProductWrapper<S[]> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 void reset()
           
 
Methods inherited from class org.databene.benerator.wrapper.MultiGeneratorWrapper
addSource, availableSourceCount, generateFromAllSources, generateFromAvailableSource, generateFromRandomSource, generateFromSource, getAvailableSource, getGeneratedType, getSource, getSources, getSourceWrapper, init, isParallelizable, isThreadSafe, setSources, toString
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, getResultWrapper, wasInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleMultiSourceArrayGenerator

public SimpleMultiSourceArrayGenerator(java.lang.Class<S> componentType,
                                       Generator<? extends S>... sources)
Initializes the generator to an array of source generators

Method Detail

generate

public ProductWrapper<S[]> generate(ProductWrapper<S[]> 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.


reset

public void reset()
Specified by:
reset in interface org.databene.commons.Resettable
Overrides:
reset in class MultiGeneratorWrapper<S,S[]>

close

public void close()
Description copied from interface: Generator
Closes the generator. After invocation the state is unavailable.

Specified by:
close in interface java.io.Closeable
Specified by:
close in interface Generator<S[]>
Overrides:
close in class MultiGeneratorWrapper<S,S[]>


Copyright © 2013. All Rights Reserved.