- java.lang.Object
-
- jakarta.ws.rs.core.EntityTag
-
public class EntityTag extends java.lang.ObjectAn abstraction for the value of a HTTP Entity Tag, used as the value of an ETag response header.- Since:
- 1.0
- See Also:
- HTTP/1.1 section 3.11
-
-
Field Summary
Fields Modifier and Type Field Description private static RuntimeDelegate.HeaderDelegate<EntityTag>HEADER_DELEGATEDeprecated.This field will be removed in a future version.private java.lang.Stringvalueprivate booleanweak
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Comparesobjto this tag to see if they are the same considering weakness and value.java.lang.StringgetValue()Get the value of anEntityTag.inthashCode()Generate hashCode based on value and weakness.booleanisWeak()Check the strength of anEntityTag.java.lang.StringtoString()Deprecated.The format of the toString() method is subject to change in a future version.static EntityTagvalueOf(java.lang.String value)Deprecated.This method will be removed in a future version.
-
-
-
Field Detail
-
HEADER_DELEGATE
@Deprecated private static final RuntimeDelegate.HeaderDelegate<EntityTag> HEADER_DELEGATE
Deprecated.This field will be removed in a future version. See https://github.com/jakartaee/rest/issues/607
-
value
private java.lang.String value
-
weak
private boolean weak
-
-
Constructor Detail
-
EntityTag
public EntityTag(java.lang.String value)
Creates a new instance of a strongEntityTag.- Parameters:
value- the value of the tag, quotes not included.- Throws:
java.lang.IllegalArgumentException- if value isnull.
-
EntityTag
public EntityTag(java.lang.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:
java.lang.IllegalArgumentException- if value isnull.
-
-
Method Detail
-
valueOf
@Deprecated public static EntityTag valueOf(java.lang.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:
java.lang.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 java.lang.String getValue()
Get the value of anEntityTag.- Returns:
- the value of the tag.
-
equals
public boolean equals(java.lang.Object obj)
Comparesobjto this tag to see if they are the same considering weakness and value.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare to.- Returns:
trueif the two tags are the same,falseotherwise.
-
hashCode
public int hashCode()
Generate hashCode based on value and weakness.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the entity tag hash code.
-
toString
@Deprecated public java.lang.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.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string version of the entity tag.
-
-