|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.databene.benerator.factory.GeneratorFactory
public class GeneratorFactory
Provides factory methods for generators.
Created: 23.08.2006 21:44:27
| Method Summary | ||
|---|---|---|
static
|
createFromWeightedLiteralList(java.lang.String valueSpec,
java.lang.Class<T> targetType,
Distribution distribution,
boolean unique)
|
|
static
|
getArrayGenerator(java.lang.Class<T> componentType,
Generator<T>... sources)
Creates a generator that reads products of an array of generators and combines them to an array. |
|
static
|
getArrayGenerator(Generator<T> source,
java.lang.Class<T> type,
int minSize,
int maxSize,
Distribution sizeDistribution)
Creates a generator that combines several products of a source generator to a collection. |
|
static Generator<java.lang.Boolean> |
getBooleanGenerator(double trueQuota)
Creates a generator for boolean values with a trueQuota [0-1] |
|
static Generator<java.lang.Character> |
getCharacterGenerator(java.lang.Character... characters)
Creates a character generator that creates values from a set of characters |
|
static Generator<java.lang.Character> |
getCharacterGenerator(java.util.Collection<java.lang.Character> characters)
Creates a character generator that creates values from a collection of characters |
|
static Generator<java.lang.Character> |
getCharacterGenerator(java.lang.String pattern,
java.util.Locale locale)
Creates a Character generator that creates characters of a Locale which match a regular expression. |
|
static
|
getCollectionGenerator(java.lang.Class<C> collectionType,
Generator<I> source,
int minSize,
int maxSize,
Distribution sizeDistribution)
Creates a generator that combines several products of a source generator to a collection. |
|
static
|
getConstantGenerator(T value)
Creates a generator that returns a constant value. |
|
static
|
getConvertingGenerator(Generator<S> source,
org.databene.commons.Converter<S,T> converter)
Creates a generator that accepts products from a source generator and converts them to target products by the converter |
|
static Generator<java.lang.String> |
getCSVCellGenerator(java.lang.String uri,
char separator,
boolean cyclic)
Creates a generator that iterates through the cells of a CSV file. |
|
static Generator<java.lang.String[]> |
getCSVLineGenerator(java.lang.String uri,
char separator,
boolean ignoreEmptyLines,
boolean cyclic)
Creates a generator that creates lines from a CSV file as String arrays. |
|
static Generator<java.util.Date> |
getDateGenerator(java.util.Date min,
java.util.Date max,
long precision,
Distribution distribution)
Creates a Date generator that generates random dates. |
|
static Generator<java.util.Date> |
getDateGenerator(java.lang.String uri,
java.lang.String encoding,
java.lang.String pattern)
Creates a date generator that generates date entries from a CSV file. |
|
static Generator<java.lang.String> |
getMessageGenerator(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
|
getNumberGenerator(java.lang.Class<T> numberType,
T min,
T max,
int totalDigits,
int fractionDigits,
T precision,
Distribution distribution,
boolean unique)
Creates a generator for numbers. |
|
static
|
getNumberGenerator(java.lang.Class<T> numberType,
T min,
T max,
T precision,
Distribution distribution,
boolean unique)
Creates a generator for numbers. |
|
static Generator<java.lang.String> |
getRegexStringGenerator(java.lang.String pattern,
int minLength,
java.lang.Integer maxLength,
boolean unique)
Creates a generator that produces Strings which match a regular expression in a locale |
|
static
|
getSampleGenerator(java.lang.Class<T> generatedType,
java.util.Collection<T> values)
Creates a Generator that chooses from a set of values with equal weights. |
|
static
|
getSampleGenerator(java.lang.Class<T> generatedType,
T... values)
Creates a Generator that chooses from an array of values with equal weights. |
|
static
|
getSampleGenerator(java.util.Collection<T> values)
Creates a Generator that chooses from a set of values with equal weights. |
|
static
|
getSampleGenerator(java.lang.String uri,
java.lang.String encoding,
org.databene.commons.Converter<java.lang.String,T> converter)
Creates a generator that reads cell Strings from a CSV file and converts them into objects by a converter |
|
static
|
getSampleGenerator(T... values)
Creates a Generator that chooses from an array of values with equal weights. |
|
static Generator<java.lang.String> |
getTextLineGenerator(java.lang.String uri,
boolean cyclic)
Creates a generator that iterates through the lines of a text file. |
|
static Generator<java.lang.Character> |
getUniqueCharacterGenerator(java.lang.String pattern,
java.util.Locale locale)
|
|
static
|
getWeightedSampleGenerator(java.util.Collection<WeightedSample<T>> samples)
Creates a generator that chooses from a set of samples, using an individual weight for each sample. |
|
static
|
getWeightedSampleGenerator(WeightedSample<T>... samples)
Creates a generator that chooses from a set of samples, using an individual weight for each sample. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Generator<java.lang.Boolean> getBooleanGenerator(double trueQuota)
trueQuota - a value from 0 to 1, indicating the quota of true values to generate among the non-null values
public static <T extends java.lang.Number> Generator<T> getNumberGenerator(java.lang.Class<T> numberType,
T min,
T max,
T precision,
Distribution distribution,
boolean unique)
numberType - the number type, e.g. java.lang.Integermin - the minimum number to generatemax - the maximum number to generateprecision - the resolution to use in number generation.distribution - The Sequence of WeightFunction to use for generation
public static <T extends java.lang.Number> Generator<T> getNumberGenerator(java.lang.Class<T> numberType,
T min,
T max,
int totalDigits,
int fractionDigits,
T precision,
Distribution distribution,
boolean unique)
numberType - the number type, e.g. java.lang.Integermin - the minimum number to generatemax - the maximum number to generateprecision - the resolution to use in number generation.
public static <T> Generator<T> createFromWeightedLiteralList(java.lang.String valueSpec,
java.lang.Class<T> targetType,
Distribution distribution,
boolean unique)
public static <T> Generator<T> getSampleGenerator(java.lang.String uri,
java.lang.String encoding,
org.databene.commons.Converter<java.lang.String,T> converter)
uri - The URI or filename to read the data fromconverter - the converter to use for representing the file entries
public static <T> Generator<T> getSampleGenerator(java.util.Collection<T> values)
values - A collection of values to choose from
public static <T> Generator<T> getSampleGenerator(java.lang.Class<T> generatedType,
java.util.Collection<T> values)
values - A collection of values to choose from
public static <T> Generator<T> getSampleGenerator(T... values)
values - An array of values to choose from
public static <T> Generator<T> getSampleGenerator(java.lang.Class<T> generatedType,
T... values)
values - An array of values to choose from
public static <T> Generator<T> getWeightedSampleGenerator(java.util.Collection<WeightedSample<T>> samples)
samples - A collection of sample values
public static <T> Generator<T> getWeightedSampleGenerator(WeightedSample<T>... samples)
samples - A collection of sample values
public static Generator<java.util.Date> getDateGenerator(java.util.Date min,
java.util.Date max,
long precision,
Distribution distribution)
min - The earliest Date to generatemax - The latest Date to generateprecision - the time resolution of dates in millisecondsdistribution - the distribution to use
public static Generator<java.util.Date> getDateGenerator(java.lang.String uri,
java.lang.String encoding,
java.lang.String pattern)
uri - the uri of the CSV file.pattern - the pattern to use for parsing the CSV cells
public static Generator<java.lang.Character> getCharacterGenerator(java.lang.String pattern,
java.util.Locale locale)
pattern - the regular expression that indicates the available range of values.
If null, any letters of the specified locale will be usedlocale - the locale to use for '\w' evaluation
public static Generator<java.lang.Character> getUniqueCharacterGenerator(java.lang.String pattern,
java.util.Locale locale)
public static Generator<java.lang.Character> getCharacterGenerator(java.util.Collection<java.lang.Character> characters)
characters - the set of characters to choose from
public static Generator<java.lang.Character> getCharacterGenerator(java.lang.Character... characters)
characters - the set of characters to choose from
public static Generator<java.lang.String> getRegexStringGenerator(java.lang.String pattern,
int minLength,
java.lang.Integer maxLength,
boolean unique)
throws org.databene.commons.ConfigurationError
pattern - the regular expressionminLength - the minimum length of the productsmaxLength - the maximum length of the products
org.databene.commons.ConfigurationError
public static <S,T> Generator<T> getConvertingGenerator(Generator<S> source,
org.databene.commons.Converter<S,T> converter)
source - the source generatorconverter - the converter to apply to the products of the source generator
public static Generator<java.lang.String> getMessageGenerator(java.lang.String pattern,
int minLength,
int maxLength,
Generator... sources)
pattern - the MessageFormat patternminLength - the minimum length of the generated valuemaxLength - the maximum length of the generated valuesources - the source generators of which to assemble the products
MessageFormat
public static <C extends java.util.Collection<I>,I> Generator<C> getCollectionGenerator(java.lang.Class<C> collectionType,
Generator<I> source,
int minSize,
int maxSize,
Distribution sizeDistribution)
collectionType - the type of collection to create, e.g. java.util.List or java.util.TreeSetsource - the generator that provides the collection itemssizeDistribution - distribution for the collection size
public static <T> Generator<T[]> getArrayGenerator(Generator<T> source,
java.lang.Class<T> type,
int minSize,
int maxSize,
Distribution sizeDistribution)
source - the generator that provides the array itemstype - the type of the arraysizeDistribution - distribution for the array length
public static <T> Generator<T[]> getArrayGenerator(java.lang.Class<T> componentType,
Generator<T>... sources)
sources - the source generators
public static <T> Generator<T> getConstantGenerator(T value)
value - the value to return
public static Generator<java.lang.String> getCSVCellGenerator(java.lang.String uri,
char separator,
boolean cyclic)
uri - the uri of the CSV fileseparator - the cell separator used in the CSV filecyclic - indicates wether iteration should restart from the first line after it reaches the file end.
public static Generator<java.lang.String[]> getCSVLineGenerator(java.lang.String uri,
char separator,
boolean ignoreEmptyLines,
boolean cyclic)
uri - the uri of the CSV fileseparator - the cell separator used in the CSV fileignoreEmptyLines - flag wether to leave out empty linescyclic - indicates wether iteration should restart from the first line after it reaches the file end.
public static Generator<java.lang.String> getTextLineGenerator(java.lang.String uri,
boolean cyclic)
uri - the uri of the text filecyclic - indicates wether iteration should restart from the first line after it reaches the file end.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||