Add support for disposeable injectors
realityforge opened this issue · comments
Peter Donald commented
A disposable injector would dispose all components contained within the injector. A binding would need to declare how they are disposed by an annotation such as @DisposedBy(Closeable.class)
or @DisposedBy(value = arez.Disposable.class, method="dispose")
. Alternatively we could invoke methods on a @Fragment
type to dispose an instance. The injector would only generate the dispose operation if explicitly requested via a parameter such as @Injector.disposeable=ENABLE
.
Peter Donald commented
For further inspiration, look at how CDI implements this with Disposer Methods