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
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddTo(HttpHeaders headers) Adds the currentETagto the given headers.booleanstatic ETagstatic ETagstatic ETagfrom(PersistentEntity<?, ? extends PersistentProperty<?>> entity, Object bean) Creates a newETagfrom the givenPersistentEntityand target bean.static ETagfrom(PersistentEntityResource resource) Creates a newETagfor the givenPersistentEntityResource.inthashCode()booleanmatches(PersistentEntity<?, ?> entity, Object target) Returns whether theETagmatches the givenPersistentEntityand target.toString()voidverify(PersistentEntity<?, ?> entity, Object target) Verifies the ETag to be created for the given target bean with the current one and raises aETagDoesntMatchExceptionin 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 newETagfor the givenPersistentEntityResource.- Parameters:
resource- must not be null.- Returns:
-
from
Creates a newETagfrom the givenPersistentEntityand 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 aETagDoesntMatchExceptionin case they don't match.- Parameters:
entity- must not be null.target- can be null.- Throws:
ETagDoesntMatchException- in case the calculatedETagfor the given bean does not match the current one.
-
matches
Returns whether theETagmatches the givenPersistentEntityand 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 currentETagto the given headers.- Parameters:
headers- must not be null.- Returns:
- the
HttpHeaderswith the ETag header been set if the currentETaginstance is notNO_ETAG.
-
toString
-
equals
-
hashCode
public int hashCode()
-