M - the type of the metadata annotation@Beta public interface TypedReleasableReferenceManager<M extends Annotation> extends ReleasableReferenceManager
ReleasableReferenceManager for a scope that is annotated with an annotation that itself
is annotated with CanReleaseReferences. That annotation is available as metadata() and may be useful at runtime to decide when to release references held by the scope.
For example:
@CanReleaseReferences
public @interface SomeAnnotation {
int value();
}
@Documented
@Retention(RUNTIME)
@SomeAnnotation(15)
@Scope
public @interface MyScope {}
// In a component that is (or has a subcomponent) annotated with @MyScope:
@Inject
void manager(
@ForReferenceReleasingScope(MyScope.class)
TypedReferenceReleasingScope<SomeAnnotation> manager) {
manager.metadata().value(); // returns 15
}
This interface is implemented by Dagger.
| Modifier and Type | Method and Description |
|---|---|
M |
metadata()
Returns the annotation on
ReleasableReferenceManager.scope() that is annotated with CanReleaseReferences. |
releaseStrongReferences, restoreStrongReferences, scopeM metadata()
ReleasableReferenceManager.scope() that is annotated with CanReleaseReferences.Copyright © 2012���2017 The Dagger Authors. All rights reserved.