org.databene.benerator.sample
Class OneShotGenerator<E>

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

public class OneShotGenerator<E>
extends ThreadSafeGenerator<E>

Returns a value only once and then becomes unavailable immediately.

Created at 23.09.2009 00:20:03

Since:
0.6.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, state
 
Constructor Summary
OneShotGenerator(E value)
           
 
Method Summary
 void close()
          Closes the generator.
 E generate()
          Returns an instance of the generic type E.
 java.lang.Class<E> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 void init(GeneratorContext context)
           
 void reset()
           
 
Methods inherited from class org.databene.benerator.util.ThreadSafeGenerator
isParallelizable, isThreadSafe
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, toString, wasInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OneShotGenerator

public OneShotGenerator(E value)
Method Detail

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>

generate

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

Throws:
IllegalGeneratorStateException

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)
          throws InvalidGeneratorSetupException
Specified by:
init in interface Generator<E>
Overrides:
init in class AbstractGenerator<E>
Throws:
InvalidGeneratorSetupException

reset

public void reset()
Specified by:
reset in interface org.databene.commons.Resettable
Overrides:
reset in class AbstractGenerator<E>


Copyright © 2011. All Rights Reserved.