org.databene.benerator.wrapper
Class DataSourceGenerator<E>

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<E>
      extended by org.databene.benerator.wrapper.DataSourceGenerator<E>
All Implemented Interfaces:
java.io.Closeable, Generator<E>, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class DataSourceGenerator<E>
extends AbstractGenerator<E>

Generator implementation which reads and forwards data from a DataSource.

Created: 24.07.2011 08:58:09

Since:
0.7.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
DataSourceGenerator()
           
DataSourceGenerator(org.databene.webdecs.DataSource<E> source)
           
 
Method Summary
 void close()
          Closes the generator.
 ProductWrapper<E> generate(ProductWrapper<E> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 java.lang.Class<E> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 org.databene.webdecs.DataSource<E> getSource()
           
 void init(GeneratorContext context)
           
 boolean isParallelizable()
           
 boolean isThreadSafe()
           
 void reset()
           
 void setSource(org.databene.webdecs.DataSource<E> source)
           
 java.lang.String 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

DataSourceGenerator

public DataSourceGenerator()

DataSourceGenerator

public DataSourceGenerator(org.databene.webdecs.DataSource<E> source)
Method Detail

getSource

public org.databene.webdecs.DataSource<E> getSource()

setSource

public void setSource(org.databene.webdecs.DataSource<E> source)

isParallelizable

public boolean isParallelizable()

isThreadSafe

public boolean isThreadSafe()

getGeneratedType

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


init

public void init(GeneratorContext context)
Specified by:
init in interface Generator<E>
Overrides:
init in class AbstractGenerator<E>

generate

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

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<E>
Overrides:
close in class AbstractGenerator<E>

toString

public java.lang.String toString()
Overrides:
toString in class AbstractGenerator<E>


Copyright © 2013. All Rights Reserved.