Package org.springframework.http
Record Class ETag
java.lang.Object
java.lang.Record
org.springframework.http.ETag
- Record Components:
tag- the unquoted tag valueweak- whether the entity tag is for weak or strong validation
Represents an ETag for HTTP conditional requests.
- Since:
- 5.3.38
- Author:
- Rossen Stoyanchev
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanPerform a strong or weak comparison to anotherETag.static ETagCreate anETaginstance from a String representation.booleanIndicates whether some other object is "equal to" this one.Return the fully formatted tag including "W/" prefix and quotes.inthashCode()Returns a hash code value for this object.booleanWhether this a wildcard tag matching to any entity tag value.Parse entity tags from an "If-Match" or "If-None-Match" header.static StringAdd quotes around the ETag value if not present already.tag()Returns the value of thetagrecord component.toString()Returns a string representation of this record class.booleanweak()Returns the value of theweakrecord component.
-
Constructor Details
-
Method Details
-
isWildcard
public boolean isWildcard()Whether this a wildcard tag matching to any entity tag value. -
compare
Perform a strong or weak comparison to anotherETag.- Parameters:
other- the ETag to compare tostrong- whether to perform strong or weak comparison- Returns:
- whether there is a match or not
- Since:
- 6.2
- See Also:
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
formattedTag
Return the fully formatted tag including "W/" prefix and quotes. -
create
Create anETaginstance from a String representation.- Parameters:
rawValue- the formatted ETag value- Returns:
- the created instance
- Since:
- 6.2
-
parse
Parse entity tags from an "If-Match" or "If-None-Match" header.- Parameters:
source- the source string to parse- Returns:
- the parsed ETags
-
quoteETagIfNecessary
Add quotes around the ETag value if not present already.- Parameters:
tag- the ETag value- Returns:
- the resulting, quoted value
- Since:
- 6.2
-
tag
Returns the value of thetagrecord component.- Returns:
- the value of the
tagrecord component
-
weak
public boolean weak()Returns the value of theweakrecord component.- Returns:
- the value of the
weakrecord component
-