Package com.github.curiousoddman.rgxgen
Class RgxGen
java.lang.Object
com.github.curiousoddman.rgxgen.RgxGen
String values generator based on regular expression pattern
-
Method Summary
Modifier and TypeMethodDescriptiongenerate()Generate random string from the pattern.Generate random string from the pattern.Generate random string that does not match a pattern.generateNotMatching(Random random) Generate random string that does not match a pattern.Returns estimation of unique values that can be generated with the pattern.Creates iterator over unique values.static RgxGenparse(RgxGenProperties rgxGenProperties, String pattern) Set properties to be used in parsing and generation.static RgxGenParse pattern using DefaultTreeBuilder.stream()Creates infinite stream of randomly generated values.
-
Method Details
-
parse
Parse pattern using DefaultTreeBuilder.- Parameters:
pattern- regex pattern for values generation
-
parse
Set properties to be used in parsing and generation.- Parameters:
rgxGenProperties- configuration properties.pattern- regex pattern for values generation- See Also:
-
getUniqueEstimation
Returns estimation of unique values that can be generated with the pattern.- Returns:
- number of unique values or null, if infinite
- API Note:
- This might not be accurate! For example the pattern "(a{0,2}|b{0,2})" will estimate to 6, though actual count is only 5, because right and left part of group can yield same value
-
stream
Creates infinite stream of randomly generated values.- Returns:
- stream of randomly generated strings
- See Also:
-
iterateUnique
Creates iterator over unique values.- Returns:
- Iterator over unique values
-
generate
Generate random string from the pattern.- Returns:
- matching random string
-
generate
Generate random string from the pattern. Random initialized with same seed will produce same results.- Parameters:
random- random to use for the generation.- Returns:
- generated string.
-
generateNotMatching
Generate random string that does not match a pattern.- Returns:
- not matching random string.
-
generateNotMatching
Generate random string that does not match a pattern. Random initialized with same seed will produce same results.- Parameters:
random- random to use for the generation.- Returns:
- generated string.
-