Class DefaultResourceRequest<T extends Resource>

java.lang.Object
org.jdrupes.builder.core.DefaultResourceRequest<T>
Type Parameters:
T - the resource type
All Implemented Interfaces:
Cloneable, ResourceRequest<T>

public class DefaultResourceRequest<T extends Resource> extends Object implements ResourceRequest<T>
An implementation of ResourceRequest.
  • Method Details

    • clone

      Overrides:
      clone in class Object
    • type

      public ResourceType<? extends T> type()
      Description copied from interface: ResourceRequest
      Returns the requested type.
      Specified by:
      type in interface ResourceRequest<T extends Resource>
      Returns:
      the resource type
    • withName

      public ResourceRequest<T> withName(String name)
      Description copied from interface: ResourceRequest

      Returns 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.

      Specified by:
      withName in interface ResourceRequest<T extends Resource>
      Parameters:
      name - the name
      Returns:
      the resource request
    • name

      public Optional<String> name()
      Description copied from interface: ResourceRequest
      Returns the name that the requested resource should have.
      Specified by:
      name in interface ResourceRequest<T extends Resource>
      Returns:
      the name if set
    • using

      public ResourceRequest<T> using(Set<Intent> intents)
      Description copied from interface: ResourceRequest
      Returns a new resource request that uses project providers with the given intents.
      Specified by:
      using in interface ResourceRequest<T extends Resource>
      Parameters:
      intents - the intents
      Returns:
      the resource request
    • uses

      public Set<Intent> uses()
      Description copied from interface: ResourceRequest
      Returns the intents to be used for selecting providers.
      Specified by:
      uses in interface ResourceRequest<T extends Resource>
      Returns:
      the intents
    • accepts

      public boolean accepts(ResourceType<?> type)
      Description copied from interface: ResourceRequest

      Returns true if resources of the given type satisfy this request. This method is typically used by providers to decide whether to provide their resources of that type in response to the request.

      Technically, this is the same as type().isAssignableFrom(type).

      Specified by:
      accepts in interface ResourceRequest<T extends Resource>
      Parameters:
      type - the type to check
      Returns:
      true if resources of the type would satisfy this request
    • isFor

      public boolean isFor(ResourceType<?> type)
      Description copied from interface: ResourceRequest

      Returns true if this request explicitly targets the type argument. This method is typically used by providers that can provide variants of a resource type to check which variant should be provided.

      Technically, this is the same as type.isAssignableFrom(type()).

      Specified by:
      isFor in interface ResourceRequest<T extends Resource>
      Parameters:
      type - the type to check
      Returns:
      true, if successful
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object