Package net.andreinc.mockneat.unit.text
Class Formatter
- java.lang.Object
-
- net.andreinc.mockneat.unit.text.Formatter
-
- All Implemented Interfaces:
MockUnit<java.lang.String>,MockUnitString
public final class Formatter extends java.lang.Object implements MockUnitString
-
-
Constructor Summary
Constructors Constructor Description Formatter(java.lang.String fmt)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Formatterfmt(java.lang.String fmt)Returns aFormatterobject than can be used to generate arbitrary patterns based on a given format.static Formatterformatter(java.lang.String fmt)Returns aFormatterobject than can be used to generate arbitrary patterns based on a given format.Formatterparam(java.lang.String param, java.lang.String constValue)This method can be used to map a parameter from the template with a String value (not a MockUnit!).<T> Formatterparam(java.lang.String param, MockUnit<T> mock)This method can be used to map a parameter from the template with a MockUnit.java.util.function.Supplier<java.lang.String>supplier()This is the sole abstract method of the interface.-
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
-
-
-
-
Method Detail
-
fmt
public static Formatter fmt(java.lang.String fmt)
Returns a
Formatterobject than can be used to generate arbitrary patterns based on a given format.- Parameters:
fmt- The template of the desired pattern.- Returns:
- A new
Formatterobject. TheFormatterclass implementsMockUnitString.
-
formatter
public static Formatter formatter(java.lang.String fmt)
Returns a
Formatterobject than can be used to generate arbitrary patterns based on a given format.- Parameters:
fmt- The template of the desired pattern.- Returns:
- A new
Formatterobject. TheFormatterclass implementsMockUnitString.
-
param
public <T> Formatter param(java.lang.String param, MockUnit<T> mock)
This method can be used to map a parameter from the template with a MockUnit.
- Type Parameters:
T- The type of the MockUnit- Parameters:
param- The parameter name as supplied in the template.mock- TheMockUnitthat generates values for the given parameter.- Returns:
- The
Formatterobject.
-
param
public Formatter param(java.lang.String param, java.lang.String constValue)
This method can be used to map a parameter from the template with a String value (not a MockUnit!).
- Parameters:
param- The parameter name as supplied in the template.constValue- The string value.- Returns:
- The
Formatterobject.
-
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.
-
-