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

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

public class SynchronizedGeneratorProxy<E>
extends java.lang.Object
implements Generator<E>

Synchronized wrapper class for non-thread-safe Generator implementations.

Created: 24.02.2010 23:08:39

Since:
0.6.0
Author:
Volker Bergmann

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.
 void init(GeneratorContext context)
           
 boolean isParallelizable()
           
 boolean isThreadSafe()
           
 void reset()
           
 boolean wasInitialized()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

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

wasInitialized

public boolean wasInitialized()
Specified by:
wasInitialized in interface Generator<E>

getGeneratedType

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

Specified by:
getGeneratedType in interface Generator<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.

Specified by:
generate in interface Generator<E>

reset

public void reset()
Specified by:
reset in interface org.databene.commons.Resettable

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>

isThreadSafe

public boolean isThreadSafe()
Specified by:
isThreadSafe in interface org.databene.commons.ThreadAware

isParallelizable

public boolean isParallelizable()
Specified by:
isParallelizable in interface org.databene.commons.ThreadAware


Copyright © 2013. All Rights Reserved.