Interface ProviderRegistration

All Known Subinterfaces:
BaseProviders, EntertainmentProviders, FoodProviders, SportProviders, VideoGameProviders
All Known Implementing Classes:
BaseFaker, EntertainmentFaker, Faker, FoodFaker, SportFaker, VideoGameFaker

public interface ProviderRegistration
  • Method Details

    • getFaker

      <B extends ProviderRegistration> B getFaker()
    • getContext

      FakerContext getContext()
    • getProvider

      default <PR extends ProviderRegistration, AP extends AbstractProvider<PR>> AP getProvider(Class<AP> clazz, Function<PR,AP> valueSupplier)
    • resolve

      String resolve(String key)
    • resolve

      String resolve(String key, Supplier<String> message)
    • numerify

      String numerify(String numberString)
    • letterify

      String letterify(String letterString)
      Returns a string with the '?' characters in the parameter replaced with random alphabetic characters.

      For example, the string "12??34" could be replaced with a string like "12AB34".

      Parameters:
      letterString - Template for string generation
      Returns:
      Generated string.
    • letterify

      String letterify(String letterString, boolean isUpper)
      Returns a string with the '?' characters in the parameter replaced with random alphabetic characters.

      For example, the string "12??34" could be replaced with a string like "12AB34".

    • bothify

      String bothify(String string)
      Applies both a numerify(String) and a letterify(String) over the incoming string.
    • bothify

      String bothify(String string, boolean isUpper)
      Applies both a numerify(String) and a letterify(String) over the incoming string.
    • regexify

      String regexify(String regex)
      Generates a String that matches the given regular expression.
    • examplify

      String examplify(String example)
      Generates a String by example. The output string will have the same pattern as the input string.

      For example: "AAA" becomes "KRA" "abc" becomes "uio" "948" becomes "345" "A19c" becomes "Z20d"

      Parameters:
      example - The input string
      Returns:
      The output string based on the input pattern
    • templatify

      String templatify(String string, char char2replace, String... options)
      Returns a string with the char2replace characters in the parameter replaced with random option from available options.

      For example, the string "ABC??EFG" could be replaced with a string like "ABCtestтестEFG" if passed options are new String[]{"test", "тест"}.

      Parameters:
      string - Template for string generation
      char2replace - Char to replace
      options - Options to use while filling the template
      Returns:
      Generated string
    • templatify

      String templatify(String string, Map<Character,String[]> optionsMap)
      Returns a string with the characters in the keys of optionsMap parameter replaced with random option from values.

      For example, the string "ABC$$EFG" could be replaced with a string like "ABCtestтестEFG" if passed for key '$' there is value new String[]{"test", "тест"} in optionsMap

      Parameters:
      string - Template for string generation
      optionsMap - Map with replacement rules
      Returns:
      Generated string
    • csv

      String csv(int limit, String... columnExpressions)
      Returns a string with generated csv based number of lines and column expressions. This method will use comma as default delimiter, always prints header and double quote as default quote.

      For example, it could generate "name_column","last_name_column" "Sabrina","Kihn"

      for expression faker.expression("#{csv '1','name_column','#{Name.first_name}','last_name_column','#{Name.last_name}'}");

      Parameters:
      limit - Number of lines
      columnExpressions - Even number of expressions. The odd numbers args are used for columns names, and even for column values.
      Returns:
      Generated string
    • csv

      String csv(String separator, char quote, boolean withHeader, int limit, String... columnExpressions)
      Returns a string with generated csv based number of lines and column expressions.

      For example, it could generate "Thad" ### "Crist" "Kathryne" ### "Wuckert" "Sybil" ### "Connelly"

      for expression faker.expression("#{csv ' ### ','"','false','3','name_column','#{Name.first_name}','last_name_column','#{Name.last_name}'}");

      Parameters:
      separator - Delimiter to use
      quote - Quote to use
      withHeader - Print header or not
      limit - Number of lines
      columnExpressions - Even number of expressions. The odd numbers args are used for columns names, and even for column values.
      Returns:
      Generated string
    • json

      String json(String... fieldExpressions)
    • jsona

      String jsona(String... fieldExpressions)
    • random

      RandomService random()
    • expression

      String expression(String expression)
    • fakeValuesService

      FakeValuesService fakeValuesService()
    • options

      default Options options()
    • addPath

      void addPath(Locale locale, Path path)
    • addUrl

      void addUrl(Locale locale, URL url)