Package org.pipservices3.commons.random
Class RandomText
java.lang.Object
org.pipservices3.commons.random.RandomText
Random generator for various text values like names, addresses or phone numbers.
### Example ###
String value1 = RandomText.name(); // Possible result: "Sergio"
String value2 = RandomText.verb(); // Possible result: "Run"
String value3 = RandomText.Text(50); // Possible result: "Run jorge. Red high scream?"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGenerates a random adjective.static Stringcolor()Generates a random color name.static Stringemail()Generates a random email address.static StringfullName()Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffixstatic Stringnoun()Generates a random noun.static Stringphone()Generates a random phone number.static Stringphrase(int size) Generates a random phrase which consists of few words separated by spaces.static Stringphrase(int minSize, int maxSize) Generates a random phrase which consists of few words separated by spaces.static Stringtext(int minSize, int maxSize) Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.static Stringverb()Generates a random verb.static Stringword()Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.static Stringwords(int min, int max) Generates a random text that consists of random number of random words separated by spaces.
-
Constructor Details
-
RandomText
public RandomText()
-
-
Method Details
-
color
Generates a random color name. The result value is capitalized.- Returns:
- a random color name.
-
noun
Generates a random noun. The result value is capitalized.- Returns:
- a random noun.
-
adjective
Generates a random adjective. The result value is capitalized.- Returns:
- a random adjective.
-
verb
Generates a random verb. The result value is capitalized.- Returns:
- a random verb.
-
phrase
Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.- Parameters:
size- the length of the phrase- Returns:
- a random phrase.
-
phrase
Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.- Parameters:
minSize- (optional) minimum string length.maxSize- maximum string length.- Returns:
- a random phrase.
-
fullName
Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffix- Returns:
- a random name.
-
word
Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.- Returns:
- a random word.
-
words
Generates a random text that consists of random number of random words separated by spaces.- Parameters:
min- (optional) a minimum number of words.max- a maximum number of words.- Returns:
- a random text.
-
phone
Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY- Returns:
- a random phone number.
-
email
Generates a random email address.- Returns:
- a random email address.
-
text
Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.- Parameters:
minSize- minimum amount of words to generate. Text will contain 'minSize' words if 'maxSize' is omitted.maxSize- (optional) maximum amount of words to generate.- Returns:
- a random text.
-