Package javax.ws.rs.core
Class EntityTag
java.lang.Object
javax.ws.rs.core.EntityTag
An abstraction for the value of a HTTP Entity Tag, used as the value
of an ETag response header.
- Since:
- 1.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Comparesobj
to this tag to see if they are the same considering weakness and value.getValue()
Get the value of anEntityTag
.int
hashCode()
Generate hashCode based on value and weakness.boolean
isWeak()
Check the strength of anEntityTag
.toString()
Convert the entity tag to a string suitable for use as the value of the corresponding HTTP header.static EntityTag
Creates a new instance ofEntityTag
by parsing the supplied string.
-
Constructor Details
-
EntityTag
Creates a new instance of a strongEntityTag
.- Parameters:
value
- the value of the tag, quotes not included.- Throws:
IllegalArgumentException
- if value isnull
.
-
EntityTag
Creates a new instance of anEntityTag
.- Parameters:
value
- the value of the tag, quotes not included.weak
-true
if this represents a weak tag,false
otherwise.- Throws:
IllegalArgumentException
- if value isnull
.
-
-
Method Details
-
valueOf
Creates a new instance ofEntityTag
by parsing the supplied string.- Parameters:
value
- the entity tag string.- Returns:
- the newly created entity tag.
- Throws:
IllegalArgumentException
- if the supplied string cannot be parsed or isnull
.
-
isWeak
public boolean isWeak()Check the strength of anEntityTag
.- Returns:
true
if this represents a weak tag,false
otherwise.
-
getValue
Get the value of anEntityTag
.- Returns:
- the value of the tag.
-
equals
Comparesobj
to this tag to see if they are the same considering weakness and value. -
hashCode
public int hashCode()Generate hashCode based on value and weakness. -
toString
Convert the entity tag to a string suitable for use as the value of the corresponding HTTP header.
-