@Beta @Documented @Target(value={FIELD,PARAMETER,METHOD}) @Retention(value=RUNTIME) @Qualifier public @interface ForReleasableReferences
Qualifier
to inject a ReleasableReferenceManager
or TypedReleasableReferenceManager
object for a particular scope.
For example:
@Documented @Retention(RUNTIME) @CanReleaseReferences @Scope public @interface MyScope {} @CanReleaseReferences public @interface MyMetadata { int value(); } @Documented @Retention(RUNTIME) @MyMetadata(15) @Scope public @interface YourScope {} class MyClass { @Inject MyClass( @ForReleasableReferences(MyScope.class) ReleasableReferenceManager myScopeReferenceManager, @ForReleasableReferences(YourScope.class) TypedReleasableReferenceManager<MyMetadata> yourScopeReferenceManager) { // … } }
Note:Releasable references uses Java's WeakReference
, and so is
not compatible with GWT.
Modifier and Type | Required Element and Description |
---|---|
Class<? extends Annotation> |
value
The reference-releasing scope annotation type.
|
public abstract Class<? extends Annotation> value
Copyright © 2012–2017 The Dagger Authors. All rights reserved.