sting-ioc / sting

Home Page:https://sting-ioc.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for disposeable injectors

realityforge opened this issue · comments

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.

For further inspiration, look at how CDI implements this with Disposer Methods