Record Class IfNoneMatch

java.lang.Object
java.lang.Record
org.apache.polaris.service.http.IfNoneMatch

public record IfNoneMatch(boolean isWildcard, @Nonnull List<String> eTags) extends Record
Logical representation of an HTTP compliant If-None-Match header.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final IfNoneMatch
     
    static final IfNoneMatch
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    IfNoneMatch(boolean isWildcard, List<String> eTags)
    Creates an instance of a IfNoneMatch record class.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    If any contained ETag matches the provided etag or the header is a wildcard.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the eTags record component.
    fromHeader(String rawValue)
    Parses the raw content of an If-None-Match header into the logical representation
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the isWildcard record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • IfNoneMatch

      public IfNoneMatch(List<String> etags)
    • IfNoneMatch

      public IfNoneMatch(boolean isWildcard, @Nonnull List<String> eTags)
      Creates an instance of a IfNoneMatch record class.
      Parameters:
      isWildcard - the value for the isWildcard record component
      eTags - the value for the eTags record component
  • Method Details

    • fromHeader

      public static IfNoneMatch fromHeader(String rawValue)
      Parses the raw content of an If-None-Match header into the logical representation
      Parameters:
      rawValue - The raw value of the If-None-Match header
      Returns:
      A logically equivalent representation of the raw header content
    • anyMatch

      public boolean anyMatch(String eTag)
      If any contained ETag matches the provided etag or the header is a wildcard. Only matches weak eTags to weak eTags and strong eTags to strong eTags.
      Parameters:
      eTag - the etag to compare against.
      Returns:
      true if any of the contained ETags match the provided etag
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • isWildcard

      public boolean isWildcard()
      Returns the value of the isWildcard record component.
      Returns:
      the value of the isWildcard record component
    • eTags

      @Nonnull public List<String> eTags()
      Returns the value of the eTags record component.
      Returns:
      the value of the eTags record component