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

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.GeneratorWrapper<E,E>
          extended by org.databene.benerator.wrapper.GeneratorProxy<E>
              extended by org.databene.benerator.wrapper.NonNullGeneratorProxy<E>
All Implemented Interfaces:
java.io.Closeable, Generator<E>, NonNullGenerator<E>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
Direct Known Subclasses:
BirthDateGenerator, CharacterGenerator, DBSequenceGenerator, EANGenerator, GenderGenerator, LocalSequenceGenerator, LuhnGenerator, RegexStringGenerator, StringGenerator, UniqueIntsGenerator

public abstract class NonNullGeneratorProxy<E>
extends GeneratorProxy<E>
implements NonNullGenerator<E>

GeneratorProxy implementation which implements the NonNullGenerator interface and supports its implementors as source Generator.

Created: 27.07.2011 11:57:17

Since:
0.7.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.wrapper.GeneratorProxy
generatedType
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
NonNullGeneratorProxy(java.lang.Class<E> generatedType)
           
NonNullGeneratorProxy(NonNullGenerator<E> source)
           
 
Method Summary
 E generate()
           
 ProductWrapper<E> generate(ProductWrapper<E> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
protected  E generateFromNotNullSource()
           
 NonNullGenerator<E> getSource()
          Returns the source generator
 void setSource(Generator<E> source)
          Sets the source generator
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorProxy
getGeneratedType, toString
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
close, equals, generateFromSource, getSourceWrapper, hashCode, init, isParallelizable, isThreadSafe, reset
 
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
 
Methods inherited from interface org.databene.benerator.Generator
close, getGeneratedType, init, wasInitialized
 
Methods inherited from interface org.databene.commons.ThreadAware
isParallelizable, isThreadSafe
 
Methods inherited from interface org.databene.commons.Resettable
reset
 

Constructor Detail

NonNullGeneratorProxy

public NonNullGeneratorProxy(java.lang.Class<E> generatedType)

NonNullGeneratorProxy

public NonNullGeneratorProxy(NonNullGenerator<E> source)
Method Detail

getSource

public NonNullGenerator<E> getSource()
Returns the source generator

Overrides:
getSource in class GeneratorWrapper<E,E>

setSource

public void setSource(Generator<E> source)
Sets the source generator

Overrides:
setSource in class GeneratorWrapper<E,E>

generateFromNotNullSource

protected final E generateFromNotNullSource()

generate

public final 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>
Overrides:
generate in class GeneratorProxy<E>

generate

public E generate()
Specified by:
generate in interface NonNullGenerator<E>


Copyright © 2013. All Rights Reserved.