Interface ResourceRequest<T extends Resource>
- Type Parameters:
T- the requested type
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
DefaultResourceRequest
Represents a request for Resources of a specified type, to be
processed by a ResourceProvider.
When requesting resources from a Project, the Project forwards
the request to its dependencies that have been associated with one
of the Intents specified with using(Set).
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(ResourceType<?> type) Checks if the query accepts results of the given type.name()Returns the name that the requested resource should have.booleanrequires(ResourceType<?> type) Checks if the query requires results of the given type.ResourceType<? extends T> type()Return the requested type.uses()Returns the intents to be used for selecting providers.Return a new resource request that uses project providers with the given intents.default ResourceRequest<T> Return a new resource request that uses a project's providers with the given intents.default ResourceRequest<T> usingAll()Return a new resource request that uses all providers of projects.Return a new resource request for a resource with the given name.
-
Method Details
-
type
-
withName
Return a new resource request for a resource with the given name.
Support for resource names is optional and provider-specific. Expect the name to be ignored if not explicitly supported for a given resource type and provider.
- Parameters:
name- the name- Returns:
- the resource request
-
name
-
using
Return a new resource request that uses project providers with the given intents.- Parameters:
intents- the intents- Returns:
- the resource request
-
using
Return a new resource request that uses a project's providers with the given intents.- Parameters:
intent- the intentintents- the intents- Returns:
- the resource request
-
usingAll
Return a new resource request that uses all providers of projects.- Returns:
- the resource request
-
uses
-
accepts
Checks if the query accepts results of the given type. This is short fortype().isAssignableFrom(type).- Parameters:
type- the type to check- Returns:
- true, if successful
-
requires
Checks if the query requires results of the given type. This is short fortype.isAssignableFrom(type()).- Parameters:
type- the type to check- Returns:
- true, if successful
-