Package org.jeasy.random
Class RecordFactory
java.lang.Object
org.jeasy.random.ObjenesisObjectFactory
org.jeasy.random.RecordFactory
- All Implemented Interfaces:
ObjectFactory
What is the justification for extending ObjenesisObjectFactory?
RecordFactory, to support nesting depth, needs access to context implementation which renders the interface (RandomizerContext)
introduced by ObjenesisObjectFactory method signature redundant. Abandoning the inheritance will hence simplify the
implementation by reducing the number of parameters, and by additionally storing the instance of RecordFactory as a field in
the EasyRandom class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
createInstance
(Class<T> type, RandomizerContext context) Create a new instance oftype
in the given randomization context.
-
Constructor Details
-
RecordFactory
public RecordFactory(org.jeasy.random.RandomizationContext contextImpl)
-
-
Method Details
-
createInstance
Description copied from interface:ObjectFactory
Create a new instance oftype
in the given randomization context.- Specified by:
createInstance
in interfaceObjectFactory
- Overrides:
createInstance
in classObjenesisObjectFactory
- Type Parameters:
T
- generic type- Parameters:
type
- to createcontext
- current randomization context- Returns:
- new instance of the given type
-