org.databene.benerator.wrapper
Class CompositeStringGenerator

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.GeneratorWrapper<java.lang.String[],java.lang.String>
          extended by org.databene.benerator.wrapper.CompositeStringGenerator
All Implemented Interfaces:
java.io.Closeable, Generator<java.lang.String>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
Direct Known Subclasses:
TokenCombiner.SimpleTokenCombinator

public class CompositeStringGenerator
extends GeneratorWrapper<java.lang.String[],java.lang.String>

Uses n String generators and appends the output of each one in each generate() call.

Created: 17.11.2007 17:33:21

Author:
Volker Bergmann

Field Summary
protected  boolean unique
           
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
CompositeStringGenerator()
           
CompositeStringGenerator(boolean unique, Generator<java.lang.String>... sources)
           
 
Method Summary
 ProductWrapper<java.lang.String> generate(ProductWrapper<java.lang.String> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 java.lang.Class<java.lang.String> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 boolean isUnique()
           
 void setSources(Generator<java.lang.String>[] sources)
           
 java.lang.String toString()
           
protected static Generator<java.lang.String[]> wrap(boolean unique, Generator<?>... sources)
           
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
close, equals, generateFromSource, getSource, getSourceWrapper, hashCode, init, isParallelizable, isThreadSafe, reset, setSource
 
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
 

Field Detail

unique

protected boolean unique
Constructor Detail

CompositeStringGenerator

public CompositeStringGenerator()

CompositeStringGenerator

public CompositeStringGenerator(boolean unique,
                                Generator<java.lang.String>... sources)
Method Detail

isUnique

public boolean isUnique()

setSources

public void setSources(Generator<java.lang.String>[] sources)

getGeneratedType

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


generate

public ProductWrapper<java.lang.String> generate(ProductWrapper<java.lang.String> 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.


toString

public java.lang.String toString()
Overrides:
toString in class GeneratorWrapper<java.lang.String[],java.lang.String>

wrap

protected static Generator<java.lang.String[]> wrap(boolean unique,
                                                    Generator<?>... sources)


Copyright © 2013. All Rights Reserved.