Class Names

java.lang.Object
net.andreinc.mockneat.abstraction.MockUnitBase
net.andreinc.mockneat.unit.user.Names
All Implemented Interfaces:
MockUnit<java.lang.String>, MockUnitString

public class Names
extends MockUnitBase
implements MockUnitString
  • Constructor Details

  • Method Details

    • names

      public static Names names()

      Returns a Names object that can be used to generate "names" (full names, first names or last names).

      Note:By default it can be used to generate people full names.

      Note: The names are the most common names that appear in the US.

      Returns:
      A re-usable Names object. The Names class implements MockUnitString.
    • supplier

      public java.util.function.Supplier<java.lang.String> supplier()
      Description copied from interface: MockUnit
      This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
      Specified by:
      supplier in interface MockUnit<java.lang.String>
      Returns:
      A Supplier<T>.
    • first

      public MockUnitString first()

      Returns a new MockUnitString that can be used to generate arbitrary first names (both male and female).

      Returns:
      A new MockUnitString.
    • firstAndMale

      public MockUnitString firstAndMale()

      Returns a new MockUnitString that can be used to generate first names (males only).

      Returns:
      A new MockUnitString.
    • firstAndFemale

      public MockUnitString firstAndFemale()

      Returns a new MockUnitString that can be used to generate first names (female only).

      Returns:
      A new MockUnitString.
    • last

      public MockUnitString last()

      Returns a new MockUnitstring that can be used to generate last names.

      Returns:
      A new MockUnitString.
    • full

      public MockUnitString full()

      Returns a new MockUnitString that can be used to generate full names (First Name + Last Name).

      Returns:
      A new MockUnitString.
    • full

      public MockUnitString full​(double middleInitialProbability)

      Returns a new MockUnitString that can be used to generate full names including a middle name (with a given probability).

      Parameters:
      middleInitialProbability - A double value between [0.0, 100.0] denoting the probability of the middle name to appear.
      Returns:
      A new MockUnitString
    • types

      public MockUnitString types​(NameType... types)

      Returns a new MockUnitString that can be used to generate names in the given array of types.

      Parameters:
      types - A var-arg array denoting the types of names that are generated.
      Returns:
      A new MockUnitString.
    • type

      public MockUnitString type​(NameType type)

      Returns a new MockUnitString that can be used to generate names of the given type.

      Parameters:
      type - The type of name we want to generate.
      Returns:
      A new MockUnitString.