Class ETag
java.lang.Object
org.springframework.data.rest.webmvc.support.ETag
A value object to represent ETags.
- Author:
- Oliver Gierke, Dario Seidl
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddTo
(HttpHeaders headers) Adds the currentETag
to the given headers.boolean
static ETag
static ETag
static ETag
from
(PersistentEntity<?, ? extends PersistentProperty<?>> entity, Object bean) Creates a newETag
from the givenPersistentEntity
and target bean.static ETag
from
(PersistentEntityResource resource) Creates a newETag
for the givenPersistentEntityResource
.int
hashCode()
boolean
matches
(PersistentEntity<?, ?> entity, Object target) Returns whether theETag
matches the givenPersistentEntity
and target.toString()
void
verify
(PersistentEntity<?, ?> entity, Object target) Verifies the ETag to be created for the given target bean with the current one and raises aETagDoesntMatchException
in case they don't match.
-
Field Details
-
NO_ETAG
-
-
Method Details
-
from
- Parameters:
value
- the source ETag value, must not be null.- Returns:
-
from
-
from
Creates a newETag
for the givenPersistentEntityResource
.- Parameters:
resource
- must not be null.- Returns:
-
from
Creates a newETag
from the givenPersistentEntity
and target bean.- Parameters:
entity
- must not be null.bean
- must not be null.- Returns:
-
verify
Verifies the ETag to be created for the given target bean with the current one and raises aETagDoesntMatchException
in case they don't match.- Parameters:
entity
- must not be null.target
- can be null.- Throws:
ETagDoesntMatchException
- in case the calculatedETag
for the given bean does not match the current one.
-
matches
Returns whether theETag
matches the givenPersistentEntity
and target. A more dissenting way of checking matches as it does not match if the ETag isNO_ETAG
.- Parameters:
entity
- must not be null.target
- can be null.- Returns:
-
addTo
Adds the currentETag
to the given headers.- Parameters:
headers
- must not be null.- Returns:
- the
HttpHeaders
with the ETag header been set if the currentETag
instance is notNO_ETAG
.
-
toString
-
equals
-
hashCode
public int hashCode()
-