org.databene.benerator.wrapper
Class WrapperFactory

java.lang.Object
  extended by org.databene.benerator.wrapper.WrapperFactory

public class WrapperFactory
extends java.lang.Object

Provides wrappers for number Generators that converts their products to a target Number type.

Created at 30.06.2009 10:48:59

Since:
0.6.0
Author:
Volker Bergmann

Constructor Summary
WrapperFactory()
           
 
Method Summary
static
<S,T> Generator<T>
applyConverter(Generator<S> source, org.databene.commons.Converter... converter)
          Creates a generator that accepts products from a source generator and converts them to target products by the converter
static
<T> Generator<T>
applyCycler(Generator<T> generator)
           
static
<T> Generator<T>
applyHeadCycler(Generator<T> source)
           
static
<T> Generator<T>
applyLastProductDetector(Generator<T> generator)
           
static
<T> OffsetBasedGenerator<T>
applyOffset(Generator<T> generator, int offset)
           
static
<T> Generator<T>
applyValidator(org.databene.commons.Validator<T> validator, Generator<T> generator)
           
static
<T> NonNullGenerator<T>
asNonNullGenerator(Generator<T> source)
           
static
<T extends java.lang.Number>
NonNullGenerator<T>
asNonNullNumberGeneratorOfType(java.lang.Class<T> numberType, NonNullGenerator<? extends java.lang.Number> source, T min, T granularity)
           
static
<T extends java.lang.Number>
Generator<T>
asNumberGeneratorOfType(java.lang.Class<T> numberType, Generator<? extends java.lang.Number> source, T min, T granularity)
           
static Generator<java.lang.String> asStringGenerator(Generator<?> source)
           
static Generator<java.lang.String>[] asStringGenerators(Generator<?>[] sources)
           
static Generator<java.lang.String> createMessageGenerator(java.lang.String pattern, int minLength, int maxLength, Generator... sources)
          Creates a generator that generates messages by reading the products of several source generators and combining them by a Java MessageFormat.
static
<T> Generator<T>
injectNulls(Generator<T> source, double nullQuota)
           
static
<T> Generator<T>
prependNull(Generator<T> source)
           
static
<T> Generator<T>
preventClosing(Generator<T> generator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrapperFactory

public WrapperFactory()
Method Detail

asNonNullNumberGeneratorOfType

public static <T extends java.lang.Number> NonNullGenerator<T> asNonNullNumberGeneratorOfType(java.lang.Class<T> numberType,
                                                                                              NonNullGenerator<? extends java.lang.Number> source,
                                                                                              T min,
                                                                                              T granularity)

asNumberGeneratorOfType

public static <T extends java.lang.Number> Generator<T> asNumberGeneratorOfType(java.lang.Class<T> numberType,
                                                                                Generator<? extends java.lang.Number> source,
                                                                                T min,
                                                                                T granularity)

asNonNullGenerator

public static <T> NonNullGenerator<T> asNonNullGenerator(Generator<T> source)

applyConverter

public static <S,T> Generator<T> applyConverter(Generator<S> source,
                                                org.databene.commons.Converter... converter)
Creates a generator that accepts products from a source generator and converts them to target products by the converter

Parameters:
source - the source generator
converter - the converter to apply to the products of the source generator
Returns:
a generator of the desired characteristics

createMessageGenerator

public static Generator<java.lang.String> createMessageGenerator(java.lang.String pattern,
                                                                 int minLength,
                                                                 int maxLength,
                                                                 Generator... sources)
Creates a generator that generates messages by reading the products of several source generators and combining them by a Java MessageFormat.

Parameters:
pattern - the MessageFormat pattern
minLength - the minimum length of the generated value
maxLength - the maximum length of the generated value
sources - the source generators of which to assemble the products
Returns:
a generator of the desired characteristics
See Also:
MessageFormat

asStringGenerators

public static Generator<java.lang.String>[] asStringGenerators(Generator<?>[] sources)

asStringGenerator

public static Generator<java.lang.String> asStringGenerator(Generator<?> source)

applyOffset

public static <T> OffsetBasedGenerator<T> applyOffset(Generator<T> generator,
                                                      int offset)

preventClosing

public static <T> Generator<T> preventClosing(Generator<T> generator)

applyValidator

public static <T> Generator<T> applyValidator(org.databene.commons.Validator<T> validator,
                                              Generator<T> generator)

applyCycler

public static <T> Generator<T> applyCycler(Generator<T> generator)

applyHeadCycler

public static <T> Generator<T> applyHeadCycler(Generator<T> source)

prependNull

public static <T> Generator<T> prependNull(Generator<T> source)

injectNulls

public static <T> Generator<T> injectNulls(Generator<T> source,
                                           double nullQuota)

applyLastProductDetector

public static <T> Generator<T> applyLastProductDetector(Generator<T> generator)


Copyright © 2013. All Rights Reserved.