Class SerialGeneratorFactory
- java.lang.Object
-
- com.rapiddweller.benerator.factory.GeneratorFactory
-
- com.rapiddweller.benerator.factory.SerialGeneratorFactory
-
public class SerialGeneratorFactory extends GeneratorFactory
GeneratorFactory
implementation which provides serial value generation and parallel combinations.
Created: 22.07.2011 10:14:36- Since:
- 0.7.0
- Author:
- Volker Bergmann
-
-
Field Summary
-
Fields inherited from class com.rapiddweller.benerator.factory.GeneratorFactory
defaultsProvider
-
-
Constructor Summary
Constructors Constructor Description SerialGeneratorFactory()
Instantiates a new Serial generator factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Generator<?>
applyNullSettings(Generator<?> source, java.lang.Boolean nullable, java.lang.Double nullQuota)
Apply null settings generator.<T> Generator<T>
createAlternativeGenerator(java.lang.Class<T> targetType, Generator<T>[] sources, Uniqueness uniqueness)
Create alternative generator generator.Generator<java.lang.Character>
createCharacterGenerator(java.lang.String pattern, java.util.Locale locale, boolean unique)
Creates a Character generator that creates characters of a Locale which match a regular expression.NonNullGenerator<java.lang.Character>
createCharacterGenerator(java.util.Set<java.lang.Character> characters)
Creates a character generator that creates values from a collection of characters<T> Generator<T[]>
createCompositeArrayGenerator(java.lang.Class<T> componentType, Generator<T>[] sources, Uniqueness uniqueness)
Creates a generator that reads products of an array of generators and combines them in an array.NonNullGenerator<java.lang.String>
createCompositeStringGenerator(GeneratorProvider<?> partGeneratorProvider, int minParts, int maxParts, Uniqueness uniqueness)
Create composite string generator non null generator.Generator<java.util.Date>
createDateGenerator(java.util.Date min, java.util.Date max, long granularity, Distribution distribution)
Creates a Date generator that generates random dates.<T> Generator<T>
createFromWeightedLiteralList(java.lang.String valueSpec, java.lang.Class<T> targetType, Distribution distribution, boolean unique)
Create from weighted literal list generator.<T> Generator<T>
createNullGenerator(java.lang.Class<T> generatedType)
Create null generator generator.<T extends java.lang.Number>
NonNullGenerator<T>createNumberGenerator(java.lang.Class<T> numberType, T min, java.lang.Boolean minInclusive, T max, java.lang.Boolean maxInclusive, T granularity, Distribution distribution, Uniqueness uniqueness)
Creates a generator for numbers.<T> Generator<T>
createSampleGenerator(java.util.Collection<T> values, java.lang.Class<T> generatedType, boolean unique)
Create sample generator generator.<T> Generator<T>
createSingleValueGenerator(T value, boolean unique)
Creates a generator that returns a single value.NonNullGenerator<java.lang.String>
createStringGenerator(java.util.Set<java.lang.Character> chars, java.lang.Integer minLength, java.lang.Integer maxLength, int lengthGranularity, Distribution lengthDistribution, Uniqueness uniqueness)
Create string generator non null generator.<T> Generator<T>
createWeightedSampleGenerator(java.util.Collection<com.rapiddweller.script.WeightedSample<T>> samples, java.lang.Class<T> targetType)
Creates a generator that chooses from a set of samples, using an individual weight for each sample.protected java.util.Set<java.lang.Integer>
defaultCounts(int minCount, int maxCount, int countPrecision)
Default counts set.Distribution
defaultDistribution(Uniqueness uniqueness)
Default distribution distribution.protected Distribution
defaultLengthDistribution(Uniqueness uniqueness, boolean required)
Default length distribution distribution.java.util.Set<java.lang.Character>
defaultSubSet(java.util.Set<java.lang.Character> characters)
Default sub set set.protected double
defaultTrueQuota()
Default true quota double.protected boolean
defaultUnique()
Default unique boolean.-
Methods inherited from class com.rapiddweller.benerator.factory.GeneratorFactory
createBooleanGenerator, createRegexStringGenerator, createStringGenerator, getDefaultsProvider, setDefaultsProvider
-
-
-
-
Method Detail
-
createAlternativeGenerator
public <T> Generator<T> createAlternativeGenerator(java.lang.Class<T> targetType, Generator<T>[] sources, Uniqueness uniqueness)
Description copied from class:GeneratorFactory
Create alternative generator generator.- Specified by:
createAlternativeGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
targetType
- the target typesources
- the sourcesuniqueness
- the uniqueness- Returns:
- the generator
-
createCompositeArrayGenerator
public <T> Generator<T[]> createCompositeArrayGenerator(java.lang.Class<T> componentType, Generator<T>[] sources, Uniqueness uniqueness)
Description copied from class:GeneratorFactory
Creates a generator that reads products of an array of generators and combines them in an array.- Specified by:
createCompositeArrayGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
componentType
- the component typesources
- the source generatorsuniqueness
- the uniqueness- Returns:
- a generator of the desired characteristics
-
createSampleGenerator
public <T> Generator<T> createSampleGenerator(java.util.Collection<T> values, java.lang.Class<T> generatedType, boolean unique)
Description copied from class:GeneratorFactory
Create sample generator generator.- Specified by:
createSampleGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
values
- the valuesgeneratedType
- the generated typeunique
- the unique- Returns:
- the generator
-
createFromWeightedLiteralList
public <T> Generator<T> createFromWeightedLiteralList(java.lang.String valueSpec, java.lang.Class<T> targetType, Distribution distribution, boolean unique)
Description copied from class:GeneratorFactory
Create from weighted literal list generator.- Specified by:
createFromWeightedLiteralList
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
valueSpec
- the value spectargetType
- the target typedistribution
- the distributionunique
- the unique- Returns:
- the generator
-
createWeightedSampleGenerator
public <T> Generator<T> createWeightedSampleGenerator(java.util.Collection<com.rapiddweller.script.WeightedSample<T>> samples, java.lang.Class<T> targetType)
Description copied from class:GeneratorFactory
Creates a generator that chooses from a set of samples, using an individual weight for each sample.- Overrides:
createWeightedSampleGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
samples
- A collection of sample valuestargetType
- the target type- Returns:
- a generator of the desired characteristics
-
createDateGenerator
public Generator<java.util.Date> createDateGenerator(java.util.Date min, java.util.Date max, long granularity, Distribution distribution)
Description copied from class:GeneratorFactory
Creates a Date generator that generates random dates.- Overrides:
createDateGenerator
in classGeneratorFactory
- Parameters:
min
- the earliest Date to generatemax
- the latest Date to generategranularity
- the time resolution of dates in millisecondsdistribution
- the distribution to use- Returns:
- a generator of the desired characteristics
-
createNumberGenerator
public <T extends java.lang.Number> NonNullGenerator<T> createNumberGenerator(java.lang.Class<T> numberType, T min, java.lang.Boolean minInclusive, T max, java.lang.Boolean maxInclusive, T granularity, Distribution distribution, Uniqueness uniqueness)
Description copied from class:GeneratorFactory
Creates a generator for numbers.- Overrides:
createNumberGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
numberType
- the number type, e.g. java.lang.Integermin
- the minimum number to generateminInclusive
- the min inclusivemax
- the maximum number to generatemaxInclusive
- the max inclusivegranularity
- the resolution to use in number generation.distribution
- The Sequence of WeightFunction to use for generationuniqueness
- the uniqueness- Returns:
- a Number generator of the desired characteristics
-
createStringGenerator
public NonNullGenerator<java.lang.String> createStringGenerator(java.util.Set<java.lang.Character> chars, java.lang.Integer minLength, java.lang.Integer maxLength, int lengthGranularity, Distribution lengthDistribution, Uniqueness uniqueness)
Description copied from class:GeneratorFactory
Create string generator non null generator.- Specified by:
createStringGenerator
in classGeneratorFactory
- Parameters:
chars
- the charsminLength
- the min lengthmaxLength
- the max lengthlengthGranularity
- the length granularitylengthDistribution
- the length distributionuniqueness
- the uniqueness- Returns:
- the non null generator
-
createCompositeStringGenerator
public NonNullGenerator<java.lang.String> createCompositeStringGenerator(GeneratorProvider<?> partGeneratorProvider, int minParts, int maxParts, Uniqueness uniqueness)
Description copied from class:GeneratorFactory
Create composite string generator non null generator.- Specified by:
createCompositeStringGenerator
in classGeneratorFactory
- Parameters:
partGeneratorProvider
- the part generator providerminParts
- the min partsmaxParts
- the max partsuniqueness
- the uniqueness- Returns:
- the non null generator
-
createCharacterGenerator
public Generator<java.lang.Character> createCharacterGenerator(java.lang.String pattern, java.util.Locale locale, boolean unique)
Description copied from class:GeneratorFactory
Creates a Character generator that creates characters of a Locale which match a regular expression.- Overrides:
createCharacterGenerator
in classGeneratorFactory
- Parameters:
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' evaluationunique
- flag indicating if character generation should be unique- Returns:
- a generator of the desired characteristics
-
createCharacterGenerator
public NonNullGenerator<java.lang.Character> createCharacterGenerator(java.util.Set<java.lang.Character> characters)
Description copied from class:GeneratorFactory
Creates a character generator that creates values from a collection of characters- Overrides:
createCharacterGenerator
in classGeneratorFactory
- Parameters:
characters
- the set of characters to choose from- Returns:
- a generator of the desired characteristics
-
defaultCounts
protected java.util.Set<java.lang.Integer> defaultCounts(int minCount, int maxCount, int countPrecision)
Default counts set.- Parameters:
minCount
- the min countmaxCount
- the max countcountPrecision
- the count precision- Returns:
- the set
-
createSingleValueGenerator
public <T> Generator<T> createSingleValueGenerator(T value, boolean unique)
Description copied from class:GeneratorFactory
Creates a generator that returns a single value.- Specified by:
createSingleValueGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
value
- the value to returnunique
- the unique- Returns:
- a generator that returns a constant value.
-
createNullGenerator
public <T> Generator<T> createNullGenerator(java.lang.Class<T> generatedType)
Description copied from class:GeneratorFactory
Create null generator generator.- Specified by:
createNullGenerator
in classGeneratorFactory
- Type Parameters:
T
- the type parameter- Parameters:
generatedType
- the generated type- Returns:
- the generator
-
defaultSubSet
public java.util.Set<java.lang.Character> defaultSubSet(java.util.Set<java.lang.Character> characters)
Description copied from class:GeneratorFactory
Default sub set set.- Overrides:
defaultSubSet
in classGeneratorFactory
- Parameters:
characters
- the characters- Returns:
- the set
-
applyNullSettings
public Generator<?> applyNullSettings(Generator<?> source, java.lang.Boolean nullable, java.lang.Double nullQuota)
Description copied from class:GeneratorFactory
Apply null settings generator.- Specified by:
applyNullSettings
in classGeneratorFactory
- Parameters:
source
- the sourcenullable
- the nullablenullQuota
- the null quota- Returns:
- the generator
-
defaultLengthDistribution
protected Distribution defaultLengthDistribution(Uniqueness uniqueness, boolean required)
Description copied from class:GeneratorFactory
Default length distribution distribution.- Specified by:
defaultLengthDistribution
in classGeneratorFactory
- Parameters:
uniqueness
- the uniquenessrequired
- the required- Returns:
- the distribution
-
defaultDistribution
public Distribution defaultDistribution(Uniqueness uniqueness)
Description copied from class:GeneratorFactory
Default distribution distribution.- Specified by:
defaultDistribution
in classGeneratorFactory
- Parameters:
uniqueness
- the uniqueness- Returns:
- the distribution
-
defaultTrueQuota
protected double defaultTrueQuota()
Description copied from class:GeneratorFactory
Default true quota double.- Specified by:
defaultTrueQuota
in classGeneratorFactory
- Returns:
- the double
-
defaultUnique
protected boolean defaultUnique()
Description copied from class:GeneratorFactory
Default unique boolean.- Specified by:
defaultUnique
in classGeneratorFactory
- Returns:
- the boolean
-
-