@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface Bind
BoundFieldModule
to indicate that a field should be bound to its value
using Guice.
supports binding annotations. For example, to bind a @Fast Car
, use
@Bind @Fast Car
.
Binding to null
is only allowed for fields that are annotated @Nullable
. See
https://github.com/google/guice/wiki/UseNullable
BoundFieldModule
Modifier and Type | Optional Element and Description |
---|---|
boolean |
lazy
If true,
BoundFieldModule will delay reading the field until injection time rather than
eagerly reading it at configure time. |
java.lang.Class<?> |
to
If specified,
BoundFieldModule will bind the annotated field's value to this type,
rather than to the field's actual type. |
public abstract java.lang.Class<?> to
BoundFieldModule
will bind the annotated field's value to this type,
rather than to the field's actual type.public abstract boolean lazy
BoundFieldModule
will delay reading the field until injection time rather than
eagerly reading it at configure time.
When used with Provider valued fields, the provider will be read from the field and .get()
will be called for each provision. This may be useful for testing provision failures.