Class EntityTag

java.lang.Object
jakarta.ws.rs.core.EntityTag

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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of a strong EntityTag.
    EntityTag(String value, boolean weak)
    Creates a new instance of an EntityTag.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares obj to this tag to see if they are the same considering weakness and value.
    Get the value of an EntityTag.
    int
    Generate hashCode based on value and weakness.
    boolean
    Check the strength of an EntityTag.
    Deprecated.
    The format of the toString() method is subject to change in a future version.
    static EntityTag
    valueOf(String value)
    Deprecated.
    This method will be removed in a future version.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EntityTag

      public EntityTag(String value)
      Creates a new instance of a strong EntityTag.
      Parameters:
      value - the value of the tag, quotes not included.
      Throws:
      IllegalArgumentException - if value is null.
    • EntityTag

      public EntityTag(String value, boolean weak)
      Creates a new instance of an EntityTag.
      Parameters:
      value - the value of the tag, quotes not included.
      weak - true if this represents a weak tag, false otherwise.
      Throws:
      IllegalArgumentException - if value is null.
  • Method Details

    • 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 of EntityTag 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 is null.
    • isWeak

      public boolean isWeak()
      Check the strength of an EntityTag.
      Returns:
      true if this represents a weak tag, false otherwise.
    • getValue

      public String getValue()
      Get the value of an EntityTag.
      Returns:
      the value of the tag.
    • equals

      public boolean equals(Object obj)
      Compares obj to this tag to see if they are the same considering weakness and value.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare to.
      Returns:
      true if the two tags are the same, false otherwise.
    • hashCode

      public int hashCode()
      Generate hashCode based on value and weakness.
      Overrides:
      hashCode in class Object
      Returns:
      the entity tag hash code.
    • 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.
      Overrides:
      toString in class Object
      Returns:
      a string version of the entity tag.