Package net.datafaker.providers.base
Class Locality
- java.lang.Object
-
- net.datafaker.providers.base.AbstractProvider<BaseProviders>
-
- net.datafaker.providers.base.Locality
-
public class Locality extends AbstractProvider<BaseProviders>
Generates random locales in different forms.- Since:
- 1.7.0
-
-
Field Summary
-
Fields inherited from class net.datafaker.providers.base.AbstractProvider
faker
-
-
Constructor Summary
Constructors Constructor Description Locality(BaseProviders baseProviders)
Constructor for Locality class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>
allSupportedLocales()
Retrieves list of all locales supported by Datafakerjava.lang.String
displayName()
Select a locale at random and returns display name of the localejava.lang.String
localeString()
java.lang.String
localeStringWithoutReplacement()
java.lang.String
localeStringWithoutReplacement(java.util.Random random)
Select a locale at random without replacement.java.lang.String
localeStringWithRandom(java.util.Random random)
Select a locale at random with replacement-
Methods inherited from class net.datafaker.providers.base.AbstractProvider
getFaker, resolve, resolve
-
-
-
-
Constructor Detail
-
Locality
public Locality(BaseProviders baseProviders)
Constructor for Locality class
-
-
Method Detail
-
allSupportedLocales
public java.util.List<java.lang.String> allSupportedLocales()
Retrieves list of all locales supported by Datafaker- Returns:
- a List of Strings with the name of the locale (eg. "es", "es-MX")
-
displayName
public java.lang.String displayName()
Select a locale at random and returns display name of the locale- Returns:
- locale in the form: "English (United States) or English"
-
localeString
public java.lang.String localeString()
- Returns:
- Randomly selected locale (eg. "es", "es-MX"). Locale is selected at random WITH replacement from all supported locales
-
localeStringWithRandom
public java.lang.String localeStringWithRandom(java.util.Random random)
Select a locale at random with replacement- Parameters:
random
- random number generator (can utilize seed for deterministic random selection)- Returns:
- String of a randomly selected locale (eg. "es", "es-MX")
-
localeStringWithoutReplacement
public java.lang.String localeStringWithoutReplacement()
- Returns:
- Randomly selected locale (eg. "es", "es-MX"). Locale is selected at random WITHOUT replacement from all supported locales
-
localeStringWithoutReplacement
public java.lang.String localeStringWithoutReplacement(java.util.Random random)
Select a locale at random without replacement. This can be used to rotate through all supported locales- Parameters:
random
- random number generator (can utilize seed for deterministic random selection)- Returns:
- String of a randomly selected locale (eg. "es", "es-MX")
-
-