Package jakarta.ws.rs.core
Class EntityTag
- java.lang.Object
-
- jakarta.ws.rs.core.EntityTag
-
- Direct Known Subclasses:
MatchingEntityTag
public class EntityTag extends Object
An abstraction for the value of a HTTP Entity Tag, used as the value of an ETag response header.- Since:
- 1.0
- Author:
- Paul Sandoz, Marc Hadley
- See Also:
- HTTP/1.1 section 3.11
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object obj)Comparesobjto this tag to see if they are the same considering weakness and value.StringgetValue()Get the value of anEntityTag.inthashCode()Generate hashCode based on value and weakness.booleanisWeak()Check the strength of anEntityTag.StringtoString()Deprecated.The format of the toString() method is subject to change in a future version.static EntityTagvalueOf(String value)Deprecated.This method will be removed in a future version.
-
-
-
Constructor Detail
-
EntityTag
public EntityTag(String value)
Creates a new instance of a strongEntityTag.- Parameters:
value- the value of the tag, quotes not included.- Throws:
IllegalArgumentException- if value isnull.
-
EntityTag
public EntityTag(String value, boolean weak)
Creates a new instance of anEntityTag.- Parameters:
value- the value of the tag, quotes not included.weak-trueif this represents a weak tag,falseotherwise.- Throws:
IllegalArgumentException- if value isnull.
-
-
Method Detail
-
valueOf
@Deprecated public static EntityTag valueOf(String value)
Deprecated.This method will be removed in a future version. Please use RuntimeDelegate.getInstance().createHeaderDelegate(EntityTag.class).fromString(value) instead.Creates a new instance ofEntityTagby 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:
trueif this represents a weak tag,falseotherwise.
-
getValue
public String getValue()
Get the value of anEntityTag.- Returns:
- the value of the tag.
-
equals
public boolean equals(Object obj)
Comparesobjto 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
@Deprecated public String toString()
Deprecated.The format of the toString() method is subject to change in a future version. Please use RuntimeDelegate.getInstance().createHeaderDelegate(EntityTag.class).toString(value) instead if you rely on the format of this method.Convert the entity tag to a string suitable for use as the value of the corresponding HTTP header.
-
-