Top Description Fields Constructors Methods
javax.ws.rs.core

public Class EntityTag

extends Object
Class Inheritance
Imports
javax.ws.rs.ext.RuntimeDelegate, .RuntimeDelegate.HeaderDelegate

An abstraction for the value of a HTTP Entity Tag, used as the value of an ETag response header.
Authors
Paul Sandoz, Marc Hadley
Since
1.0
See Also
HTTP/1.1 section 3.11

Field Summary

Modifier and TypeField and Description
private static final RuntimeDelegate.HeaderDelegate<EntityTag>
private String
private boolean

Constructor Summary

AccessConstructor and Description
public
EntityTag(final String
the value of the tag, quotes not included.
value
)

Creates a new instance of a strong EntityTag.

public
EntityTag(final String
the value of the tag, quotes not included.
value
,
final boolean
true if this represents a weak tag, false otherwise.
weak
)

Creates a new instance of an EntityTag.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the two tags are the same, false otherwise.
equals
(final Object
the object to compare to.
obj
)

Overrides java.lang.Object.equals.

Compares obj to this tag to see if they are the same considering weakness and value.
public String

Returns:

the value of the tag.
getValue
()

Get the value of an EntityTag.

public int

Returns:

the entity tag hash code.
hashCode
()

Overrides java.lang.Object.hashCode.

Generate hashCode based on value and weakness.
public boolean

Returns:

true if this represents a weak tag, false otherwise.
isWeak
()

Check the strength of an EntityTag.

public String

Returns:

a string version of the entity tag.
toString
()

Overrides java.lang.Object.toString.

Convert the entity tag to a string suitable for use as the value of the corresponding HTTP header.
public static EntityTag

Returns:

the newly created entity tag.
valueOf
(final String
the entity tag string.
value
)

Creates a new instance of EntityTag by parsing the supplied string.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

HEADER_DELEGATEback to summary
private static final RuntimeDelegate.HeaderDelegate<EntityTag> HEADER_DELEGATE
valueback to summary
private String value
weakback to summary
private boolean weak

Constructor Detail

EntityTagback to summary
public EntityTag(final String value)

Creates a new instance of a strong EntityTag.

Parameters
value:String

the value of the tag, quotes not included.

Exceptions
IllegalArgumentException:
if value is null.
EntityTagback to summary
public EntityTag(final String value, final boolean weak)

Creates a new instance of an EntityTag.

Parameters
value:String

the value of the tag, quotes not included.

weak:boolean

true if this represents a weak tag, false otherwise.

Exceptions
IllegalArgumentException:
if value is null.

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Compares obj to this tag to see if they are the same considering weakness and value.

Parameters
obj:Object

the object to compare to.

Returns:boolean

true if the two tags are the same, false otherwise.

Annotations
@Override
getValueback to summary
public String getValue()

Get the value of an EntityTag.

Returns:String

the value of the tag.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Generate hashCode based on value and weakness.

Returns:int

the entity tag hash code.

Annotations
@Override
isWeakback to summary
public boolean isWeak()

Check the strength of an EntityTag.

Returns:boolean

true if this represents a weak tag, false otherwise.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert the entity tag to a string suitable for use as the value of the corresponding HTTP header.

Returns:String

a string version of the entity tag.

Annotations
@Override
valueOfback to summary
public static EntityTag valueOf(final String value)

Creates a new instance of EntityTag by parsing the supplied string.

Parameters
value:String

the entity tag string.

Returns:EntityTag

the newly created entity tag.

Exceptions
IllegalArgumentException:
if the supplied string cannot be parsed or is null.