Package org.jeasy.random.api
Interface ObjectFactory
- All Known Implementing Classes:
ObjenesisObjectFactory
,RecordFactory
public interface ObjectFactory
Strategy interface for object creation.
- Since:
- 4.0
- Author:
- Mahmoud Ben Hassine ([email protected])
-
Method Summary
Modifier and TypeMethodDescription<T> T
createInstance
(Class<T> type, RandomizerContext context) Create a new instance oftype
in the given randomization context.
-
Method Details
-
createInstance
Create a new instance oftype
in the given randomization context.- Type Parameters:
T
- generic type- Parameters:
type
- to createcontext
- current randomization context- Returns:
- new instance of the given type
- Throws:
ObjectCreationException
- when unable to create an instance of the given type
-