Class PersonService


  • public final class PersonService
    extends Object
    Class that acts as service for accessing numerous Persons. The values are randomly put together out of names and places from "The Simpsons"
    • Method Detail

      • getRandomPersons

        public static List<Person> getRandomPersons​(int numberOfPersons)
        Creates a list of random Persons.
        Parameters:
        numberOfPersons - The number of Persons that should be generated.
        Returns:
        A list containing the given amount of random generated persons.
      • getFixedPersons

        public static List<Person> getFixedPersons()
        Returns:
        A fixed list of Persons.
      • getFixedPersonsWithNull

        public static List<Person> getFixedPersonsWithNull()
        Returns:
        A fixed list of Persons with a few null values.
      • getFixedMixedPersons

        public static List<Person> getFixedMixedPersons()
        Returns:
        A fixed list of Persons with a few double values.
      • getPersons

        public static List<Person> getPersons​(int numberOfPersons)
        Creates a list of Persons.
        Parameters:
        numberOfPersons - The number of Persons that should be generated.
        Returns:
        A list of Persons.
      • getAddress

        public static List<Address> getAddress​(int number)
        Creates a list of Address.
        Parameters:
        number - The number of Address that should be generated.
        Returns:
        A list of Address.
      • createAddress

        public static Address createAddress()
        Creates a random address out of street names, postal codes and city names which are taken from "The Simpsons" (i haven't found postal codes, so here i invented some for the example)
        Returns:
        A random address.
      • createPersonWithAddress

        public static PersonWithAddress createPersonWithAddress​(int id)
        Creates a random person out of names which are taken from "The Simpsons" and enrich them with random generated married state and birthday date. Also adds a random address out of street names, postal codes and city names which are taken from "The Simpsons" (i haven't found postal codes, so here i invented some for the example)
        Parameters:
        id - A unique id for the person.
        Returns:
        A random person with a random address.
      • createExtendedPersonWithAddress

        public static ExtendedPersonWithAddress createExtendedPersonWithAddress​(int id)
        Creates a random person out of names which are taken from "The Simpsons" and enrich them with random generated married state and birthday date. Adds a random address out of street names, postal codes and city names which are taken from "The Simpsons" (i haven't found postal codes, so here i invented some for the example). Also adds extended information like a password, a random long description text, a money balance and collections of favourite food and drinks.
        Parameters:
        id - A unique id for the person.
        Returns:
        A random person with a random address and some random extended information.
      • generateSimplePassword

        public static String generateSimplePassword()
        Returns:
        A simple password consisting of 8 characters in the value ranges a-z, A-Z
      • getStreetNames

        public static String[] getStreetNames()
        Returns:
        An array of street names that are also used to create random addresses.
      • getCityNames

        public static String[] getCityNames()
        Returns:
        An array of city names that are also used to create random addresses.
      • getFoodList

        public static String[] getFoodList()
        Returns:
        An array of food names.
      • getDrinkList

        public static String[] getDrinkList()
        Returns:
        An array of drink names.
      • createRandomLengthText

        public static String createRandomLengthText()
        Returns:
        A custom length text containing line breaks
      • createRandomMoneyAmount

        public static Double createRandomMoneyAmount()