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
-
-
Field Summary
-
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MockUnitStringfirst()Returns a newMockUnitStringthat can be used to generate arbitrary first names (both male and female).MockUnitStringfirstAndFemale()Returns a newMockUnitStringthat can be used to generate first names (female only).MockUnitStringfirstAndMale()Returns a newMockUnitStringthat can be used to generate first names (males only).MockUnitStringfull()Returns a newMockUnitStringthat can be used to generate full names (First Name + Last Name).MockUnitStringfull(double middleInitialProbability)Returns a newMockUnitStringthat can be used to generate full names including a middle name (with a given probability).MockUnitStringlast()Returns a newMockUnitstringthat can be used to generate last names.static Namesnames()Returns aNamesobject that can be used to generate "names" (full names, first names or last names).java.util.function.Supplier<java.lang.String>supplier()This is the sole abstract method of the interface.MockUnitStringtype(NameType type)Returns a newMockUnitStringthat can be used to generate names of the given type.MockUnitStringtypes(NameType... types)Returns a newMockUnitStringthat can be used to generate names in the given array of types.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnitString
accumulate, append, array, base64, escapeCsv, escapeEcmaScript, escapeHtml, escapeXml, format, md2, md5, noSpecialChars, prepend, replace, replace, replaceAll, replaceFirst, sha1, sha256, sha384, sha512, split, split, sub, sub, urlEncode, urlEncode
-
-
-
-
Constructor Detail
-
Names
protected Names()
-
Names
public Names(MockNeat mockNeat)
-
-
Method Detail
-
names
public static Names names()
Returns a
Namesobject 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
Namesobject. TheNamesclass implementsMockUnitString.
-
supplier
public java.util.function.Supplier<java.lang.String> supplier()
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
first
public MockUnitString first()
Returns a new
MockUnitStringthat can be used to generate arbitrary first names (both male and female).- Returns:
- A new
MockUnitString.
-
firstAndMale
public MockUnitString firstAndMale()
Returns a new
MockUnitStringthat can be used to generate first names (males only).- Returns:
- A new
MockUnitString.
-
firstAndFemale
public MockUnitString firstAndFemale()
Returns a new
MockUnitStringthat can be used to generate first names (female only).- Returns:
- A new
MockUnitString.
-
last
public MockUnitString last()
Returns a new
MockUnitstringthat can be used to generate last names.- Returns:
- A new
MockUnitString.
-
full
public MockUnitString full()
Returns a new
MockUnitStringthat can be used to generate full names (First Name + Last Name).- Returns:
- A new
MockUnitString.
-
full
public MockUnitString full(double middleInitialProbability)
Returns a new
MockUnitStringthat 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
MockUnitStringthat 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
MockUnitStringthat can be used to generate names of the given type.- Parameters:
type- The type of name we want to generate.- Returns:
- A new
MockUnitString.
-
-