Top Description Fields Constructors Methods
org.easymock.internal

public Class InjectionTarget

extends Object
Class Inheritance
Imports
java.lang.reflect.Field

Applies an Injection to a target field.
Authors
Henri Tremblay, Alistair Todd
Since
3.3

Field Summary

Modifier and TypeField and Description
private final Field

Constructor Summary

AccessConstructor and Description
public
InjectionTarget(Field
Field that will receive the Injection
f
)

Create instance for injection to the given field.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if injection represents a mock that can be applied to this InjectionTarget, false if the mock is of a type that cannot be assigned
accepts
(Injection
candidate Injection
injection
)

Can the given Injection be applied to this InjectionTarget?

public Field

Returns:

target field for injection assignment.
getTargetField
()

Get the field to which injections will be assigned.

public void
inject(Object
Object instance on which to perform injection.
obj
,
Injection
Injection containing mock to assign.
injection
)

Perform the injection against the given object set the "matched" status of the injection when successful.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

targetFieldback to summary
private final Field targetField

Constructor Detail

InjectionTargetback to summary
public InjectionTarget(Field f)

Create instance for injection to the given field.

Parameters
f:Field

Field that will receive the Injection

Method Detail

acceptsback to summary
public boolean accepts(Injection injection)

Can the given Injection be applied to this InjectionTarget?

Parameters
injection:Injection

candidate Injection

Returns:boolean

true if injection represents a mock that can be applied to this InjectionTarget, false if the mock is of a type that cannot be assigned

getTargetFieldback to summary
public Field getTargetField()

Get the field to which injections will be assigned.

Returns:Field

target field for injection assignment.

injectback to summary
public void inject(Object obj, Injection injection)

Perform the injection against the given object set the "matched" status of the injection when successful.

Parameters
obj:Object

Object instance on which to perform injection.

injection:Injection

Injection containing mock to assign.