public class ExistingGenerator extends Object implements InstanceProvider
Only one instance per individual class.
| Modifier and Type | Method and Description |
|---|---|
Object |
create(Class<?> type)
Create an instance given a type, if possible.
|
static ExistingGenerator |
fromObjectArray(Object[] values)
Create an instance generator from a pre-defined array of values.
|
static ExistingGenerator |
fromObjectFields(Object object)
Automatically create an instance provider from a objects public and private fields.
|
static ExistingGenerator |
fromObjectFields(Object object,
Class<?> type)
Automatically create an instance provider from a objects public and private fields.
|
public static ExistingGenerator fromObjectFields(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 fromObjectFields(Object object, Class<?> type)
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.type - - the type to cast the object.public static ExistingGenerator fromObjectArray(Object[] values)
values - - values to provide.public Object create(@Nullable Class<?> type)
InstanceProvidercreate in interface InstanceProvidertype - - type to create.Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.