Interface ResourceProviderSpi
BuildContext
by implementations of resource providers.-
Method Summary
Modifier and TypeMethodDescriptionprovide(ResourceRequest<T> request) Provide the requested resources.
-
Method Details
-
provide
Provide the requested resources. This method is not intended to be invoked directly. Rather, it must be invoked via
BuildContext.resources(ResourceProvider, ResourceRequest).When properly invoked through
BuildContext.resources(ResourceProvider, ResourceRequest), this method is never invoked twice for the same request (unless there has been a request forCleanlinessin between). The method may, however, be invoked concurrently for different requests.Providers that evaluate all potentially provided resources anyway and return only a subset for some actually requested
ResourceTypes should therefore invoke themselves throughResourceProvider.resources(ResourceRequest)with a request for all resources and filter the (automatically cached) result.Special care must be taken when handling resource type hierarchies. If
ResourceTypeB extends ResourceType A and the provider provides ResourceType B, it must also provide its resources in response to a request for ResourceType A. However, the caching mechanism is unaware of relationships between resource types. Requests for A and B are therefore forwarded independently. To avoid duplicate evaluation, the provider must map a request for A to a request for B (viaResourceProvider.resources(ResourceRequest)).- Type Parameters:
T- the type of the requested (and provided) resource- Parameters:
request- the request for resources- Returns:
- the provided resource(s) as stream
-