public final class ETag extends Object
Modifier and Type | Method and Description |
---|---|
HttpHeaders |
addTo(HttpHeaders headers)
Adds the current
ETag to the given headers. |
boolean |
equals(Object obj) |
static ETag |
from(PersistentEntity<?,?> entity,
Object bean)
Creates a new
ETag from the given PersistentEntity and target bean. |
static ETag |
from(PersistentEntityResource resource)
Creates a new
ETag for the given PersistentEntityResource . |
static ETag |
from(String value)
|
int |
hashCode() |
boolean |
matches(PersistentEntity<?,?> entity,
Object target)
Returns whether the
ETag matches the given PersistentEntity and target. |
String |
toString() |
void |
verify(PersistentEntity<?,?> entity,
Object target)
Verifies the ETag to be created for the given target bean with the current one and raises a
ETagDoesntMatchException in case they don't match. |
public static final ETag NO_ETAG
public static ETag from(String value)
value
- the source ETag value, can be null.public static ETag from(PersistentEntityResource resource)
ETag
for the given PersistentEntityResource
.resource
- can be null.public static ETag from(PersistentEntity<?,?> entity, Object bean)
ETag
from the given PersistentEntity
and target bean.entity
- must not be null.bean
- must not be null.public void verify(PersistentEntity<?,?> entity, Object target)
ETagDoesntMatchException
in case they don't match.entity
- must not be null.target
- can be null.ETagDoesntMatchException
- in case the calculated ETag
for the given bean does not match the current
one.public boolean matches(PersistentEntity<?,?> entity, Object target)
ETag
matches the given PersistentEntity
and target. A more dissenting way of
checking matches as it does not match if the ETag is NO_ETAG
.entity
- must not be null.target
- can be null.public HttpHeaders addTo(HttpHeaders headers)
ETag
to the given headers.headers
- must not be null.HttpHeaders
with the ETag header been set if the current ETag
instance is not
NO_ETAG
.Copyright © 2011-2015–2016 Pivotal Software, Inc.. All rights reserved.