Package org.mockserver.templates.engine
Class TemplateFunctions
java.lang.Object
org.mockserver.templates.engine.TemplateFunctions
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()static StringrandomBytes(int size) static StringrandomInteger(int max) static net.datafaker.FakerresolveFaker(long templateFakerSeed) Resolve thefakerhelper bound into template contexts.toString()
-
Field Details
-
BUILT_IN_FUNCTIONS
-
BUILT_IN_HELPERS
-
-
Constructor Details
-
TemplateFunctions
-
-
Method Details
-
resolveFaker
public static net.datafaker.Faker resolveFaker(long templateFakerSeed) Resolve thefakerhelper bound into template contexts.When
templateFakerSeedis 0 (the default) the shared, unseededFAKERis returned, so faker-driven sample data stays time/random-based and behaviour is unchanged. When a non-zero seed is configured a freshFakerbacked by aRandomseeded with that value is returned, so faker-driven templates produce reproducible fixtures across runs (the template analogue of the OpenAPISampleDataGeneratorfixed-seed model). The returned seeded faker is intended to be created once per template engine and reused across renders, so its value sequence is deterministic for a given order of renders.- Parameters:
templateFakerSeed- faker seed, 0 to leave faker unseeded (random)- Returns:
- the shared unseeded faker when the seed is 0, otherwise a freshly seeded faker
-
randomInteger
-
randomBytes
-
get
-
toString
-