Class RandomGenerator


  • public class RandomGenerator
    extends Object

    Random generator uses a pattern to generate a random sequence based on given pattern.

    the supported characters are (can appear in pattern string):

    • # - numeric
    • a - lowercase letter
    • A - uppercase letter
    • ? - lowercase and uppercase letter
    • . - any character

    Any other character inside the pattern is directly printed to the output.

    Backslash is used to escape any character. For instance pattern "###\\.##" prints a floating point random number

    org.identityconnectors.contract.data.macro.RandomMacro -- written by Dan Vernon, the original source of random generating functionality.

    Note: This is just a helper class. Users will directly use methods get() and random() of class Lazy.

    Author:
    David Adam, Zdenek Louzensky
    • Constructor Detail

      • RandomGenerator

        public RandomGenerator()
    • Method Detail

      • generate

        public static String generate​(String pattern)
        generate a random string based on given pattern
        Parameters:
        pattern - see the definition in class header
      • generate

        public static Object generate​(String pattern,
                                      Class<?> clazz)

        generates a random string based on given pattern, finally tries to call constructor on the given class accepting a string argument.

        Parameters:
        pattern - see the definition in class header
        Returns:
        object initialized with random string