Package org.apache.tapestry5.test
Class RandomDataSource
- java.lang.Object
- 
- org.apache.tapestry5.test.RandomDataSource
 
- 
 public final class RandomDataSource extends java.lang.Object Provides access to random data that can be used when populating a test database with "reasonable" data. The majority of this is access to random words from an american english dictionary, which can be strung together to form names, sentences and paragraphs.
- 
- 
Constructor SummaryConstructors Constructor Description RandomDataSource()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcapitalizedWord()Returns a random word, capitalized.booleanmaybe(int percent)<T extends java.lang.Enum>
 ToneOf(java.lang.Class<T> enumClass)Returns a random enum value, given the enum type.<T> ToneOf(T... values)Returns a random value from the list of values supplied.java.lang.Stringparagraph(int minSentences, int maxSentences, int minWords, int maxWords)Strings together a random number of word lists (in sentence form) to create something that looks like a paragraph.intrandom(int min, int max)java.lang.StringsafeWord()Returns a word that is "safe" for use in an email address.java.lang.Stringword()Returns a random word frm the dictionary.java.lang.StringwordList(int minWords, int maxWords, boolean asSentence)Creates a space-separated list of random words.
 
- 
- 
- 
Constructor Detail- 
RandomDataSourcepublic RandomDataSource() 
 
- 
 - 
Method Detail- 
maybepublic boolean maybe(int percent) 
 - 
randompublic int random(int min, int max) 
 - 
wordpublic java.lang.String word() Returns a random word frm the dictionary. These words are usually all lowercase.
 - 
capitalizedWordpublic java.lang.String capitalizedWord() Returns a random word, capitalized. Useful when create random names.
 - 
safeWordpublic java.lang.String safeWord() Returns a word that is "safe" for use in an email address.
 - 
oneOfpublic <T> T oneOf(T... values) Returns a random value from the list of values supplied.
 - 
oneOfpublic <T extends java.lang.Enum> T oneOf(java.lang.Class<T> enumClass) Returns a random enum value, given the enum type.
 - 
wordListpublic java.lang.String wordList(int minWords, int maxWords, boolean asSentence) Creates a space-separated list of random words. If in sentence form, then the first word is capitalized, and a period is appended.- Parameters:
- minWords- minimun number of words in the list
- maxWords- maximum number of words in the list
- asSentence- if true, the output is "dressed up" as a non-sensical sentence
- Returns:
- the word list / sentence
 
 - 
paragraphpublic java.lang.String paragraph(int minSentences, int maxSentences, int minWords, int maxWords) Strings together a random number of word lists (in sentence form) to create something that looks like a paragraph.- Parameters:
- minSentences- per paragraph
- maxSentences- per paragraph
- minWords- per sentence
- maxWords- per sentence
- Returns:
- the random paragraph
 
 
- 
 
-