You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#416 - Alter ResourceAssemblerSupport.toResources to return Resources
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.
Related issues: #493
Related pull requests: #572
* Base class to implement {@link ResourceAssembler}s. Will automate {@link ResourceSupport} instance creation and make
@@ -57,7 +59,9 @@ public ResourceAssemblerSupport(Class<?> controllerClass, Class<D> resourceType)
57
59
* @see #toResource(Object)
58
60
* @param entities must not be {@literal null}.
59
61
* @return
62
+
* @deprecated Results of this method may not render properly if returned by a Spring MVC endpoint. Cast your {@link Iterable} parameter as an {@link Object} to use the new API, which does.
* Converts an {@link Iterable} collection of entities into {@link Resources}. To maintain backward compatibility, using this method requires casting the {@link Iterable} input as an {@link Object}.
79
+
*
80
+
* TODO: Migrate from {@link Object} to {@link Iterable} when old method is removed and remove the runtime {@link ClassUtils#isAssignable(Class, Class)} check.
81
+
*
82
+
* @param entities
83
+
* @return
84
+
*/
85
+
publicResources<D> toResources(Objectentities) {
86
+
87
+
Assert.isTrue(ClassUtils.isAssignable(Iterable.class, entities.getClass()), "Entities must be Iterable!");
0 commit comments