org.databene.benerator.nullable
Class ValidatingNullableGeneratorProxy<E>
java.lang.Object
org.databene.benerator.nullable.AbstractNullableGenerator<P>
org.databene.benerator.nullable.NullableGeneratorWrapper<E,E>
org.databene.benerator.nullable.ValidatingNullableGeneratorProxy<E>
- All Implemented Interfaces:
- java.io.Closeable, NullableGenerator<E>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
public class ValidatingNullableGeneratorProxy<E>
- extends NullableGeneratorWrapper<E,E>
Proxy for NullableGenerator that only generates products which pass a validator.
Created: 18.02.2010 11:19:59
- Since:
- 0.6.0
- Author:
- Volker Bergmann
|
Field Summary |
static int |
ERROR_THRESHOLD
The number of invalid consecutive generations that causes an exception |
protected org.databene.commons.Validator<? super E> |
validator
The validator used for validation |
static int |
WARNING_THRESHOLD
The number of invalid consecutive generations that causes a warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WARNING_THRESHOLD
public static final int WARNING_THRESHOLD
- The number of invalid consecutive generations that causes a warning
- See Also:
- Constant Field Values
ERROR_THRESHOLD
public static final int ERROR_THRESHOLD
- The number of invalid consecutive generations that causes an exception
- See Also:
- Constant Field Values
validator
protected org.databene.commons.Validator<? super E> validator
- The validator used for validation
ValidatingNullableGeneratorProxy
public ValidatingNullableGeneratorProxy(NullableGenerator<E> realValidator,
org.databene.commons.Validator<? super E> validator)
- Constructor that takes the validator
getGeneratedType
public java.lang.Class<E> getGeneratedType()
generate
public ProductWrapper<E> generate(ProductWrapper<E> wrapper)
- Generator implementation that calls generateImpl() to generate values
and validator.validate() in order to validate them.
Consecutive invalid values are counted. If this count reaches the
WARNING_THRESHOLD value, a warning is logged, if the count reaches the
ERROR_THRESHOLD, an exception is raised.
Copyright © 2011. All Rights Reserved.