Class ETagResource<T>

java.lang.Object
de.xima.fc.common.etag.ETagResource<T>
Type Parameters:
T - Type of the resource.
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ETagResource.Modified, ETagResource.NotFound, ETagResource.NotModified

public abstract class ETagResource<T> extends Object implements Serializable
Represents a resource cached via the ETag mechanism. An etag resource has three possible states: (1) The resource was not found. (2) The resource was not modified. (3) The resource was modified.
Since:
8.3.0
Author:
XIMA MEDIA GmbH
See Also:
  • Method Details

    • match

      public <R> R match(ETagResource.Matcher<T,R> matcher)
      Matches this resource against the given matcher. Invokes the method corresponding to the status of this resource.
      Type Parameters:
      R - Type returned by the matcher.
      Parameters:
      matcher - Matcher to use.
      Returns:
      Result as returned by the matcher.
    • modified

      public static <T> ETagResource<T> modified(ETag tag, T resource)
      Creates an ETag resource that represents a modified resource.
      Type Parameters:
      T - Type of the resource.
      Parameters:
      tag - ETag of the resource, must not be null.
      resource - Wrapped resource, must not be null.
      Returns:
      A new ETag resource.
    • notFound

      public static <T> ETagResource<T> notFound()
      Gets an ETag resource representing a resource that was not found.
      Type Parameters:
      T - Type of the resource.
      Returns:
      A new ETag resource.
    • notModified

      public static <T> ETagResource<T> notModified()
      Gets an ETag resource representing a resource that was not modified.
      Type Parameters:
      T - Type of the resource.
      Returns:
      A new ETag resource.