Improve support for requests for optional services
realityforge opened this issue · comments
The current version (i.e. v0.05
) supports adding the @Nullable
annotation when requesting a service. If the service is not available then a null is returned. Other forms of service requests for optional services should be supported.
You should be able to add the following types as constructor parameters in @Injectable
types or as provider method parameters in @Fragment
annotated types.
@Nullable T
Optional<T>
Supplier<Optional<T>
Collection<Supplier<Optional<T>
We should also add support for nullability when requesting Collection<T>
by just omitting service from collection.
There is no real reason not to add this other than it requires additional engineering effort and there is no application that requires this functionality at this stage.