Package org.instancio

Interface Model<T>

Type Parameters:
T - the type of object encapsulated by this model

public interface Model<T>
A model is a template for creating objects and contains all the parameters for populating a class specified using Instancio API.

A model can be created using the InstancioApi.toModel() method. An instance of a model can then be used for creating and customising objects and other models.

Example:


 Model<Person> simpsons = Instancio.of(Person.class)
     .set(field(Person::getLastName), "Simpson")
     .set(field(Address::getCity), "Springfield")
     .generate(field(Person::getAge), gen -> gen.ints().range(40, 50))
     .toModel();

 Person homer = Instancio.of(simpsons)
     .set(field(Person::getFirstName), "Homer")
     .create();

 Person marge = Instancio.of(simpsons)
     .set(field(Person::getFirstName), "Marge")
     .create();
 
Since:
1.0.1