public class ExistingGenerator extends java.lang.Object implements InstanceProvider
Only one instance per individual class.
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
create(java.lang.Class<?> type)
Create an instance given a type, if possible.
|
static ExistingGenerator |
fromObjectArray(java.lang.Object[] values)
Create an instance generator from a pre-defined array of values.
|
static ExistingGenerator |
fromObjectFields(java.lang.Object object)
Automatically create an instance provider from a objects public and private fields.
|
public static ExistingGenerator fromObjectFields(java.lang.Object object)
If two or more fields share the same type, the last declared non-null field will take precedent.
object
- - object to create an instance generator from.public static ExistingGenerator fromObjectArray(java.lang.Object[] values)
values
- - values to provide.public java.lang.Object create(@Nullable java.lang.Class<?> type)
InstanceProvider
create
in interface InstanceProvider
type
- - type to create.