org.identityconnectors.contract.data
Class RandomGenerator

java.lang.Object
  extended by org.identityconnectors.contract.data.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):

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 Summary
RandomGenerator()
           
 
Method Summary
static String generate(String pattern)
          generate a random string based on given pattern
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


Copyright © 2011. All Rights Reserved.