public final class RandomDataSource extends java.lang.Object
Constructor and Description |
---|
RandomDataSource() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
capitalizedWord()
Returns a random word, capitalized.
|
boolean |
maybe(int percent) |
<T extends java.lang.Enum> |
oneOf(java.lang.Class<T> enumClass)
Returns a random enum value, given the enum type.
|
<T> T |
oneOf(T... values)
Returns a random value from the list of values supplied.
|
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.
|
int |
random(int min,
int max) |
java.lang.String |
safeWord()
Returns a word that is "safe" for use in an email address.
|
java.lang.String |
word()
Returns a random word frm the dictionary.
|
java.lang.String |
wordList(int minWords,
int maxWords,
boolean asSentence)
Creates a space-separated list of random words.
|
public RandomDataSource()
public boolean maybe(int percent)
public int random(int min, int max)
public java.lang.String word()
public java.lang.String capitalizedWord()
public java.lang.String safeWord()
public <T> T oneOf(T... values)
public <T extends java.lang.Enum> T oneOf(java.lang.Class<T> enumClass)
public java.lang.String wordList(int minWords, int maxWords, boolean asSentence)
minWords
- minimun number of words in the listmaxWords
- maximum number of words in the listasSentence
- if true, the output is "dressed up" as a non-sensical sentencepublic java.lang.String paragraph(int minSentences, int maxSentences, int minWords, int maxWords)
minSentences
- per paragraphmaxSentences
- per paragraphminWords
- per sentencemaxWords
- per sentence${project.version} - Copyright © 2003-2015 The Apache Software Foundation.