InvocationScope
public
class
InvocationScope
extends Object
implements
Scope
java.lang.Object | |
↳ | com.android.tradefed.guice.InvocationScope |
Scopes a single Tradefed invocation.
The scope can be initialized with one or more seed values by calling seed(key, value)
before the injector will be called upon to provide for this key. A typical use is for a
test invocation to enter/exit the scope, representing an invocation Scope, and seed configuration
objects. For each key inserted with seed(), you must include a corresponding binding:
bind(key)
.toProvider(SimpleScope.seededKeyProvider())
.in(InvocationScoped.class);
FIXME: Possibly handle multi objects (like lists).
Summary
Public constructors | |
---|---|
InvocationScope()
|
Public methods | |
---|---|
void
|
enter()
Start marking the scope of the Tradefed Invocation. |
void
|
exit()
Mark the end of the scope for the Tradefed Invocation. |
static
InvocationScope
|
getDefault()
|
<T>
Provider<T>
|
scope(Key<T> key, Provider<T> unscoped)
|
<T>
void
|
seed(Key<T> key, T value)
Seed a key/value that will be available during the TF invocation scope to be used. |
<T>
void
|
seed(Class<T> clazz, T value)
Seed a key/value that will be available during the TF invocation scope to be used. |
void
|
seedConfiguration(IConfiguration config)
Interface init between Tradefed and Guice: This is the place where TF object are seeded to the invocation scope to be used. |
static
<T>
Provider<T>
|
seededKeyProvider()
Returns a provider that always throws exception complaining that the object in question must be seeded before it can be injected. |
Public constructors
InvocationScope
public InvocationScope ()
Public methods
enter
public void enter ()
Start marking the scope of the Tradefed Invocation.
exit
public void exit ()
Mark the end of the scope for the Tradefed Invocation.
scope
public Provider<T> scope (Key<T> key, Provider<T> unscoped)
Parameters | |
---|---|
key |
Key |
unscoped |
Provider |
Returns | |
---|---|
Provider<T> |
seed
public void seed (Key<T> key, T value)
Seed a key/value that will be available during the TF invocation scope to be used.
Parameters | |
---|---|
key |
Key : the key used to represent the object. |
value |
T : The actual object that will be available during the invocation.
|
seed
public void seed (Class<T> clazz, T value)
Seed a key/value that will be available during the TF invocation scope to be used.
Parameters | |
---|---|
clazz |
Class : the Class used to represent the object. |
value |
T : The actual object that will be available during the invocation.
|
seedConfiguration
public void seedConfiguration (IConfiguration config)
Interface init between Tradefed and Guice: This is the place where TF object are seeded to the invocation scope to be used.
Parameters | |
---|---|
config |
IConfiguration : The Tradefed configuration.
|
seededKeyProvider
public static Provider<T> seededKeyProvider ()
Returns a provider that always throws exception complaining that the object in question must be seeded before it can be injected.
Returns | |
---|---|
Provider<T> |
typed provider |