Interface ResourceRequest<T extends Resource>

Type Parameters:
T - the requested type
All Superinterfaces:
Cloneable
All Known Implementing Classes:
DefaultResourceRequest

public interface ResourceRequest<T extends Resource> extends Cloneable

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 Details

    • type

      ResourceType<? extends T> type()
      Return the requested type.
      Returns:
      the resource 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

      Returns the name that the requested resource should have.
      Returns:
      the name if set
    • using

      Return a new resource request that uses project providers with the given intents.
      Parameters:
      intents - the intents
      Returns:
      the resource request
    • using

      default ResourceRequest<T> using(Intent intent, Intent... intents)
      Return a new resource request that uses a project's providers with the given intents.
      Parameters:
      intent - the intent
      intents - the intents
      Returns:
      the resource request
    • usingAll

      Return a new resource request that uses all providers of projects.
      Returns:
      the resource request
    • uses

      Returns the intents to be used for selecting providers.
      Returns:
      the sets the
    • accepts

      boolean accepts(ResourceType<?> type)
      Checks if the query accepts results of the given type. This is short for type().isAssignableFrom(type).
      Parameters:
      type - the type to check
      Returns:
      true, if successful
    • requires

      boolean requires(ResourceType<?> type)
      Checks if the query requires results of the given type. This is short for type.isAssignableFrom(type()).
      Parameters:
      type - the type to check
      Returns:
      true, if successful