Files
spring-data-rest/spring-data-rest-core
Oliver Gierke 3a66bc75e2 DATAREST-724 - Added configuration API for entity lookup customizations.
RepositoryRestConfiguration now exposes a withCustomEntityLookup() returning an EntityLookupRegistrar that allows to define customizations as follows on Java 8:

config.withCustomEntityLookup()
  .forRepository(UserRepository.class)
  .withIdMapping(User::getUsername)
  .withLookup(UserRepository::findByUsername);

or even abbreviated to:

config.withCustomEntityLookup()
  .forRepository(UserRepository.class, User::getUsername, UserRepository::findByUsername);

The API basically takes two lambdas or method references to define the id mapping (User::getUsername in this case) as well as the lookup call based on the repository type with which the customization builder was set up in the first place (UserRepository::findByUsername in this case).
2015-12-09 16:00:32 +01:00
..