Class Factory<T,R>
- java.lang.Object
-
- net.andreinc.mockneat.unit.objects.Factory<T,R>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T,FT>
Factory<T,FT>factory(java.lang.Class<T> targetClass, java.lang.Class<FT> factoryClass)Returns a newFactoryobject that can be used to instantiate Java Objects by calling a static factory method and supplying it with arbitrary data.Factory<T,R>method(java.lang.String methodName)Specifies the static method name.Factory<T,R>params(java.lang.Object... params)Specified the params that are going to be supplied to the static factory method.java.util.function.Supplier<T>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
-
-
-
-
Method Detail
-
factory
public static <T,FT> Factory<T,FT> factory(java.lang.Class<T> targetClass, java.lang.Class<FT> factoryClass)
Returns a new
Factoryobject that can be used to instantiate Java Objects by calling a static factory method and supplying it with arbitrary data.The
Factoryclass implementsMockUnit<T>.- Type Parameters:
T- The type of the target classFT- The type of the factory class- Parameters:
targetClass- The Java class we want to create instances of.factoryClass- The Java class that contains the static-factory method we want to invoke.- Returns:
- The factory MockUnit
-
method
public Factory<T,R> method(java.lang.String methodName)
Specifies the static method name.
- Parameters:
methodName- The method factory method used to instantiate the class.- Returns:
- The same instance of the previously created
Factoryobject. TheFactoryclass implements theMockUnit<T>interface.
-
params
public Factory<T,R> params(java.lang.Object... params)
Specified the params that are going to be supplied to the static factory method.
Note: If a
MockUnitis supplied as a parameter theval()method is invoked instead of using the actual value.- Parameters:
params- A var-arg array being the list ofparamssupplied to the factory method.- Returns:
- The same instance of the
Factoryobject. THeFactoryclass implements theMockUnit<T>interface.
-
-