Package org.apache.maven.impl.cache
Record Class PartialCacheConfig
java.lang.Object
java.lang.Record
org.apache.maven.impl.cache.PartialCacheConfig
- Record Components:
scope- the cache retention scope (nullable)referenceType- the reference type to use for cache entries (nullable)
public record PartialCacheConfig(CacheRetention scope, Cache.ReferenceType referenceType)
extends Record
Partial cache configuration that allows specifying only scope or reference type.
Used for merging configurations from multiple selectors.
-
Constructor Summary
ConstructorsConstructorDescriptionPartialCacheConfig(CacheRetention scope, Cache.ReferenceType referenceType) Creates an instance of aPartialCacheConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic PartialCacheConfigcomplete(CacheRetention scope, Cache.ReferenceType referenceType) Creates a complete partial configuration with both scope and reference type.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if this configuration is complete (both values are non-null).booleanisEmpty()Checks if this configuration is empty (both values are null).mergeWith(PartialCacheConfig other) Merges this configuration with another, with this configuration taking precedence for non-null values.Returns the value of thereferenceTyperecord component.scope()Returns the value of thescoperecord component.Converts this partial configuration to a complete CacheConfig, using defaults for missing values.final StringtoString()Returns a string representation of this record class.static PartialCacheConfigwithReferenceType(Cache.ReferenceType referenceType) Creates a partial configuration with only reference type specified.static PartialCacheConfigwithScope(CacheRetention scope) Creates a partial configuration with only scope specified.
-
Constructor Details
-
PartialCacheConfig
Creates an instance of aPartialCacheConfigrecord class.- Parameters:
scope- the value for thescoperecord componentreferenceType- the value for thereferenceTyperecord component
-
-
Method Details
-
withScope
Creates a partial configuration with only scope specified. -
withReferenceType
Creates a partial configuration with only reference type specified. -
complete
Creates a complete partial configuration with both scope and reference type. -
mergeWith
Merges this configuration with another, with this configuration taking precedence for non-null values.- Parameters:
other- the other configuration to merge with- Returns:
- a new merged configuration
-
toComplete
Converts this partial configuration to a complete CacheConfig, using defaults for missing values.- Returns:
- a complete CacheConfig
-
isEmpty
public boolean isEmpty()Checks if this configuration is empty (both values are null). -
isComplete
public boolean isComplete()Checks if this configuration is complete (both values are non-null). -
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). -
scope
Returns the value of thescoperecord component.- Returns:
- the value of the
scoperecord component
-
referenceType
Returns the value of thereferenceTyperecord component.- Returns:
- the value of the
referenceTyperecord component
-