Package org.instancio.internal
Class OfMapApiImpl<K,V,M extends Map<K,V>>
java.lang.Object
org.instancio.internal.ApiImpl<T>
org.instancio.internal.OfClassApiImpl<M>
org.instancio.internal.OfMapApiImpl<K,V,M>
- All Implemented Interfaces:
InstancioApi<M>,InstancioOfClassApi<M>,InstancioOfCollectionApi<M>
public final class OfMapApiImpl<K,V,M extends Map<K,V>>
extends OfClassApiImpl<M>
implements InstancioOfCollectionApi<M>
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.instancio.internal.OfClassApiImpl
withTypeParametersMethods inherited from class org.instancio.internal.ApiImpl
addTypeParameters, asResult, create, generate, generate, ignore, lenient, onComplete, set, stream, subtype, supply, supply, toModel, withMaxDepth, withNullable, withSeed, withSettingsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.instancio.InstancioApi
asResult, create, generate, generate, ignore, lenient, onComplete, set, stream, subtype, supply, supply, toModel, withMaxDepth, withNullable, withSeed, withSettings
-
Constructor Details
-
OfMapApiImpl
-
-
Method Details
-
size
Description copied from interface:InstancioOfCollectionApiSpecifies collection size to generate.This method is syntactic sugar for:
List<Integer> result = Instancio.ofList(Integer.class) .generate(root(), gen -> gen.collection().size(50)) .create();Therefore, if you modify the collection generator via
root()selector (for example, to specify the collection's type) then you will need to specify the size using the generator as well.For example, instead of:
List<Integer> result = Instancio.ofList(Integer.class) .size(50) .generate(root(), gen -> gen.collection().subtype(LinkedList.class)) .create();use:
List<Integer> result = Instancio.ofList(Integer.class) .generate(root(), gen -> gen.collection().subtype(LinkedList.class).size(50)) .create();- Specified by:
sizein interfaceInstancioOfCollectionApi<K>- Parameters:
size- of the collection to generate- Returns:
- API builder reference
-