org.databene.benerator.wrapper
Class ConvertingGenerator<S,T>

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

public class ConvertingGenerator<S,T>
extends GeneratorWrapper<S,T>

Reads products from a source Generator and applies a Converter to transform them into the target products.

Created: 12.06.2006 19:02:30

Author:
Volker Bergmann

Field Summary
protected  org.databene.commons.Converter<?,?>[] converters
          The converter to apply to the source's products
 
Fields inherited from class org.databene.benerator.wrapper.GeneratorWrapper
source
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, state
 
Constructor Summary
ConvertingGenerator(Generator<S> source, org.databene.commons.Converter<?,?>... converters)
          Initializes all attributes
 
Method Summary
 T generate()
          Returns an instance of the generic type E.
 java.lang.Class<T> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 void init(GeneratorContext context)
           
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
close, equals, getSource, hashCode, isParallelizable, isThreadSafe, reset, setSource, toString
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, wasInitialized
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

converters

protected org.databene.commons.Converter<?,?>[] converters
The converter to apply to the source's products

Constructor Detail

ConvertingGenerator

public ConvertingGenerator(Generator<S> source,
                           org.databene.commons.Converter<?,?>... converters)
Initializes all attributes

Method Detail

init

public void init(GeneratorContext context)
Specified by:
init in interface Generator<T>
Overrides:
init in class GeneratorWrapper<S,T>

getGeneratedType

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


generate

public T generate()
Description copied from interface: Generator
Returns an instance of the generic type E.

See Also:
Generator.generate()


Copyright © 2011. All Rights Reserved.