org.databene.benerator.wrapper
Class NullInjectingGeneratorProxy<E>
java.lang.Object
org.databene.benerator.util.AbstractGenerator<P>
org.databene.benerator.wrapper.GeneratorWrapper<E,E>
org.databene.benerator.wrapper.GeneratorProxy<E>
org.databene.benerator.wrapper.NullInjectingGeneratorProxy<E>
- All Implemented Interfaces:
- java.io.Closeable, Generator<E>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
- Direct Known Subclasses:
- SectorGenerator
public class NullInjectingGeneratorProxy<E>
- extends GeneratorProxy<E>
GeneratorProxy
implementation which injects a given quota of null values in the
original generator's results.
Created: 26.01.2010 10:32:58
- Since:
- 0.6.0
- Author:
- Volker Bergmann
Method Summary |
ProductWrapper<E> |
generate(ProductWrapper<E> wrapper)
First checks if a null value should be returned, if so it returns a wrapper that wraps a null value,
otherwise a wrapper that wraps a value generated by the underlying source generator. |
protected boolean |
shouldNullify()
|
java.lang.String |
toString()
|
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper |
close, equals, generateFromSource, getSource, getSourceWrapper, hashCode, init, isParallelizable, isThreadSafe, reset, setSource |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
NullInjectingGeneratorProxy
public NullInjectingGeneratorProxy(Generator<E> source,
double nullQuota)
generate
public ProductWrapper<E> generate(ProductWrapper<E> wrapper)
- First checks if a null value should be returned, if so it returns a wrapper that wraps a null value,
otherwise a wrapper that wraps a value generated by the underlying source generator. If that generator
is not available any more,
null
is returned.
- Specified by:
generate
in interface Generator<E>
- Overrides:
generate
in class GeneratorProxy<E>
shouldNullify
protected boolean shouldNullify()
toString
public java.lang.String toString()
- Overrides:
toString
in class GeneratorProxy<E>
Copyright © 2013. All Rights Reserved.