Record Class CacheSelector

java.lang.Object
java.lang.Record
org.apache.maven.impl.cache.CacheSelector
Record Components:
parentRequestType -
requestType -
config -

public record CacheSelector(String parentRequestType, String requestType, PartialCacheConfig config) extends Record
A cache selector that matches requests based on their type and optional parent request type. Supports CSS-like selectors: - "RequestType" matches any request of that type - "ParentType RequestType" matches RequestType with ParentType as parent - "ParentType *" matches any request with ParentType as parent - "* RequestType" matches RequestType with any parent (equivalent to just "RequestType")
  • Constructor Details

    • CacheSelector

      public CacheSelector(String parentRequestType, String requestType, PartialCacheConfig config)
      Creates an instance of a CacheSelector record class.
      Parameters:
      parentRequestType - the value for the parentRequestType record component
      requestType - the value for the requestType record component
      config - the value for the config record component
  • Method Details

    • forRequestType

      public static CacheSelector forRequestType(String requestType, PartialCacheConfig config)
      Creates a selector that matches any request of the specified type.
    • forParentAndRequestType

      public static CacheSelector forParentAndRequestType(String parentRequestType, String requestType, PartialCacheConfig config)
      Creates a selector that matches requests with a specific parent type.
    • matches

      public boolean matches(Request<?> req)
      Checks if this selector matches the given request.
      Parameters:
      req - the request to match
      Returns:
      true if this selector matches the request
    • toString

      public 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • parentRequestType

      public String parentRequestType()
      Returns the value of the parentRequestType record component.
      Returns:
      the value of the parentRequestType record component
    • requestType

      public String requestType()
      Returns the value of the requestType record component.
      Returns:
      the value of the requestType record component
    • config

      public PartialCacheConfig config()
      Returns the value of the config record component.
      Returns:
      the value of the config record component