Interface EntityLookup<T>
- All Superinterfaces:
org.springframework.plugin.core.Plugin<Class<?>>
- All Known Implementing Classes:
EntityLookupSupport
SPI to customize which property of an entity is used as unique identifier and how the entity instance is looked up
from the backend. Prefer to extend
EntityLookupSupport
to let the generics declaration be used for the
Plugin.supports(Object)
method automatically.- Since:
- 2.5
- Author:
- Oliver Gierke
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the lookup property if available.getResourceIdentifier
(T entity) Returns the property of the given entity that shall be used to uniquely identify it.lookupEntity
(Object id) Returns the entity instance to be used if an entity with the given identifier value is requested.Methods inherited from interface org.springframework.plugin.core.Plugin
supports
-
Method Details
-
getResourceIdentifier
Returns the property of the given entity that shall be used to uniquely identify it. If noEntityLookup
is defined for a particular type, a standard identifier lookup mechanism (i.e. the datastore identifier) will be used to eventually create an identifying URI.- Parameters:
entity
- will never be null.- Returns:
- must not be null.
-
lookupEntity
Returns the entity instance to be used if an entity with the given identifier value is requested. Implementations will usually forward the call to a repository method explicitly and can assume the given value be basically the value they returned ingetResourceIdentifier(Object)
.Implementations are free to return null to indicate absence of a value or wrap the result into any generally supported
Optional
type.- Parameters:
id
- will never be null.- Returns:
- can be null.
-
getLookupProperty
Returns the lookup property if available. IfOptional.empty()
is returned, we assume the identifier property is the one to be used for lookup.- Returns:
- will never be null.
-