Class RandomText

java.lang.Object
org.pipservices3.commons.random.RandomText

public class RandomText extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Generates a random adjective.
    static String
    Generates a random color name.
    static String
    Generates a random email address.
    static String
    Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffix
    static String
    Generates a random noun.
    static String
    Generates a random phone number.
    static String
    phrase(int size)
    Generates a random phrase which consists of few words separated by spaces.
    static String
    phrase(int minSize, int maxSize)
    Generates a random phrase which consists of few words separated by spaces.
    static String
    text(int minSize, int maxSize)
    Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.
    static String
    Generates a random verb.
    static String
    Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.
    static String
    words(int min, int max)
    Generates a random text that consists of random number of random words separated by spaces.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RandomText

      public RandomText()
  • Method Details

    • color

      public static String color()
      Generates a random color name. The result value is capitalized.
      Returns:
      a random color name.
    • noun

      public static String noun()
      Generates a random noun. The result value is capitalized.
      Returns:
      a random noun.
    • adjective

      public static String adjective()
      Generates a random adjective. The result value is capitalized.
      Returns:
      a random adjective.
    • verb

      public static String verb()
      Generates a random verb. The result value is capitalized.
      Returns:
      a random verb.
    • phrase

      public static String phrase(int size)
      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

      public static String phrase(int minSize, int maxSize)
      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

      public static String 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

      public static String word()
      Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.
      Returns:
      a random word.
    • words

      public static String words(int min, int max)
      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

      public static String phone()
      Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY
      Returns:
      a random phone number.
    • email

      public static String email()
      Generates a random email address.
      Returns:
      a random email address.
    • text

      public static String text(int minSize, int maxSize)
      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.