#135 - HAL embedded resources are now rendered as collection by default.

To get consistent representations rendered for single-item collections and multi-item collections, we now use an enforceEmbeddedCollections flag in the Jackson 2 HAL module. Adapted HalEmbeddedBuilder to respect that setting and exposed it via the HandlerInstantiator for user level customization.

Changed RelProvider.getSingleResourceRel(…) to getItemResourceRel(…).
This commit is contained in:
Oliver Gierke
2014-01-24 14:50:41 +01:00
parent 9caa352470
commit bb0a578701
13 changed files with 77 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,11 +18,25 @@ package org.springframework.hateoas;
import org.springframework.plugin.core.Plugin;
/**
* API to provide relation types for collections and items of the given type.
*
* @author Oliver Gierke
*/
public interface RelProvider extends Plugin<Class<?>> {
String getSingleResourceRelFor(Class<?> type);
/**
* Returns the relation type to be used to point to an item resource of the given type.
*
* @param type must not be {@literal null}.
* @return
*/
String getItemResourceRelFor(Class<?> type);
/**
* Returns the relation type to be used to point to a collection resource of the given type.
*
* @param type must not be {@literal null}.
* @return
*/
String getCollectionResourceRelFor(Class<?> type);
}