Package org.instancio
Interface OnCompleteCallback<T>
- Type Parameters:
T- type handled by the callback
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A callback that gets invoked after an object has been fully populated.
- Since:
- 1.0.4
-
Method Summary
Modifier and TypeMethodDescriptionvoidonComplete(T object) A callback method that is called after an object has been populated.
-
Method Details
-
onComplete
A callback method that is called after an object has been populated.If a
nullvalue is generated for a selector with a callback, the callback will not be invoked.In the following snippet, all
Phoneinstances are nullable and also have a callback associated with them. The callback will only be called when a non-null value is generated.Person person = Instancio.of(Person.class) .withNullable(all(Phone.class)) .onComplete(all(Phone.class), (Phone phone) -> { // will only be called on non-null phones }) .create();- Parameters:
object- fully populated instance to call the callback on- Since:
- 1.0.4
-