DATAREST-479 - Empty collections now render a dedicated _embedded property.

Instead of rendering an empty _embedded document for empty collections and pages we now explicitly trigger the creations of an EmbeddedWrapper for that empty, collection to preserve the collection's element type.

Tweaked ResourceProcessorHandlerMethodReturnValueHandler to invoke ResourceProcessor instances for those empty collections, too. PRHMRVH now checks the assignability of the raw resource type before analyzing the value type for a match.

RepositorySearchController now adds additional self links for the list of searches and a search execution.
This commit is contained in:
Oliver Gierke
2015-05-18 18:01:08 +02:00
parent f1e928a744
commit 17305f4067
13 changed files with 162 additions and 63 deletions

View File

@@ -50,7 +50,7 @@ public interface MethodResourceMapping extends ResourceMapping {
/**
* Returns the domain type that the query method returns. This will inspect wrapper types ({@link Collection}s,
* {@link Map}s, {@link Optional}s etc.) for their elemtn or value types.
* {@link Map}s, {@link Optional}s etc.) for their element or value types.
*
* @return will never be {@literal null}.
* @since 2.3

View File

@@ -111,7 +111,28 @@ public class SearchResourceMappings implements Iterable<MethodResourceMapping>,
for (MethodResourceMapping mapping : this) {
if (mapping.isExported() && mapping.getRel().endsWith(rel)) {
if (mapping.isExported() && mapping.getRel().equals(rel)) {
return mapping;
}
}
return null;
}
/**
* Returns the {@link MethodResourceMapping} for the given path.
*
* @param path must not be {@literal null} or empty.
* @return
* @since 2.4
*/
public MethodResourceMapping getExportedMethodMappingForPath(String path) {
Assert.hasText(path, "Path must not be null or empty!");
for (MethodResourceMapping mapping : this) {
if (mapping.isExported() && mapping.getPath().matches(path)) {
return mapping;
}
}