Package net.datafaker.service
Class FakerContext
java.lang.Object
net.datafaker.service.FakerContext
Contains the changeable Faker's part which currently contains
Locale
and RandomService
.-
Field Summary
-
Constructor Summary
ConstructorDescriptionFakerContext
(Locale locale, RandomService randomService) Resolves YAML file using the most specific path first based on language and country code. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
protected List<SingletonLocale>
protected List<SingletonLocale>
localeChain
(Locale from) Convert the specified locale into a chain of locales used for message resolution.void
setCurrentLocale
(Locale locale) void
void
setRandomService
(RandomService randomService) toString()
-
Field Details
-
DEFAULT_SINGLETON_LOCALE_LIST
-
-
Constructor Details
-
FakerContext
Resolves YAML file using the most specific path first based on language and country code. 'en_US' would resolve in the following order:- /en-US.yml
- /en.yml
Locale
instance. This is legacy behavior and not condoned, but it will work.- EN_US
- En-Us
- eN_uS
-
-
Method Details
-
setLocale
-
setRandomService
-
getLocale
-
getSingletonLocale
-
getRandomService
-
getLocaleChain
-
setCurrentLocale
-
localeChain
Convert the specified locale into a chain of locales used for message resolution. For example:Locale.FRANCE
(fr_FR) to [ fr_FR, anotherTest, en ]- Returns:
- a list of
Locale
instances
-
localeChain
-
equals
-
hashCode
public int hashCode() -
toString
-