Added @Relation annotation to be able to define the relations that shall be exposed. The annotation can be used on domain classes or ResourceSupport subtypes to define the relations that shall be used to build links pointing to them. Introduced RelProvider implementations that use the plain domain class name plus an appended List by default (DefaultRelProvider, fallback) as well as an AnnotationRelProvider that will inspect @Relation on the domain type. Added a DelegatingRelProvider that is based on a Spring Plugin PluginRegistry to allow adding RelProvider implementations transparently. Polished AnnotationRelProvider (added annotation caching) and corrected ControllerRelProvider to lookup relation types from Controller classes. Added BeanDefinition setup to HypermediaSupportBeanDefinitionRegistrar to setup a PluginRegistry of RelProviders and the wrapping DelegatingRelProvider to become the primary auto wiring candidate. Moved RelProvider registration into Jackson HandlerInstantiator implementations. Made the BeanPostProcessors for Jackson ObjectMapper customization aware of the BeanFactory to lookup the DelegatingRelProvider instance to hand them into the Jackson HandlerInstantiators. TODOs: - More tests - Correctly register ControllerRelProviders
This commit is contained in:
@@ -15,12 +15,14 @@
|
||||
*/
|
||||
package org.springframework.hateoas;
|
||||
|
||||
import org.springframework.plugin.core.Plugin;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public interface RelProvider {
|
||||
public interface RelProvider extends Plugin<Class<?>> {
|
||||
|
||||
String getRelForCollectionResource(Class<?> type);
|
||||
String getSingleResourceRelFor(Class<?> type);
|
||||
|
||||
String getRelForSingleResource(Class<?> type);
|
||||
String getCollectionResourceRelFor(Class<?> type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user