Package org.instancio.generator.text
Class TextGenerators
- java.lang.Object
-
- org.instancio.generator.text.TextGenerators
-
public class TextGenerators extends Object
Contains built-in text generators.
-
-
Constructor Summary
Constructors Constructor Description TextGenerators()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GeneratorSpec<String>
pattern(String pattern)
Generates a random string based on the specified pattern template.
-
-
-
Method Detail
-
pattern
public GeneratorSpec<String> pattern(String pattern)
Generates a random string based on the specified pattern template. The template supports the following hashtags:#c
- lower case character[a-z]
#C
- upper case character[A-Z]
#d
- digit[0-9]
##
- hash symbol escape
Examples:
"#d#d#d-#d#d#d-#d#d#d" -> "123-45-67" "Foo: #C#c#c" -> "Foo: Xyz" "###d#d#d" -> "#123"
- Parameters:
pattern
- to generate- Returns:
- string pattern generator
-
-