|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mockito.internal.util.reflection.FieldInitializer
public class FieldInitializer
Initialize a field with type instance if a default constructor can be found.
If the given field is already initialized, then the actual instance is returned. This initializer doesn't work with inner classes, local classes, interfaces or abstract types.
Nested Class Summary | |
---|---|
static interface |
FieldInitializer.ConstructorArgumentResolver
Represents the strategy used to resolve actual instances to be given to a constructor given the argument types. |
Constructor Summary | |
---|---|
FieldInitializer(java.lang.Object fieldOwner,
java.lang.reflect.Field field)
Prepare initializer with the given field on the given instance. |
|
FieldInitializer(java.lang.Object fieldOwner,
java.lang.reflect.Field field,
FieldInitializer.ConstructorArgumentResolver argResolver)
Prepare initializer with the given field on the given instance. |
Method Summary | |
---|---|
FieldInitializationReport |
initialize()
Initialize field if not initialized and return the actual instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FieldInitializer(java.lang.Object fieldOwner, java.lang.reflect.Field field)
This constructor fail fast if the field type cannot be handled.
fieldOwner
- Instance of the test.field
- Field to be initialize.public FieldInitializer(java.lang.Object fieldOwner, java.lang.reflect.Field field, FieldInitializer.ConstructorArgumentResolver argResolver)
This constructor fail fast if the field type cannot be handled.
fieldOwner
- Instance of the test.field
- Field to be initialize.argResolver
- Constructor parameters resolverMethod Detail |
---|
public FieldInitializationReport initialize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |