Package org.apache.maven.impl.cache
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 Summary
ConstructorsConstructorDescriptionCacheSelector(String parentRequestType, String requestType, PartialCacheConfig config) Creates an instance of aCacheSelectorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionconfig()Returns the value of theconfigrecord component.final booleanIndicates whether some other object is "equal to" this one.static CacheSelectorforParentAndRequestType(String parentRequestType, String requestType, PartialCacheConfig config) Creates a selector that matches requests with a specific parent type.static CacheSelectorforRequestType(String requestType, PartialCacheConfig config) Creates a selector that matches any request of the specified type.final inthashCode()Returns a hash code value for this object.booleanChecks if this selector matches the given request.Returns the value of theparentRequestTyperecord component.Returns the value of therequestTyperecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
CacheSelector
Creates an instance of aCacheSelectorrecord class.- Parameters:
parentRequestType- the value for theparentRequestTyperecord componentrequestType- the value for therequestTyperecord componentconfig- the value for theconfigrecord component
-
-
Method Details
-
forRequestType
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
Checks if this selector matches the given request.- Parameters:
req- the request to match- Returns:
- true if this selector matches the request
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
parentRequestType
Returns the value of theparentRequestTyperecord component.- Returns:
- the value of the
parentRequestTyperecord component
-
requestType
Returns the value of therequestTyperecord component.- Returns:
- the value of the
requestTyperecord component
-
config
Returns the value of theconfigrecord component.- Returns:
- the value of the
configrecord component
-