#645 - Upgraded to Spring Plugin 2.0.

This commit is contained in:
Oliver Gierke
2017-10-13 18:21:15 +02:00
parent ba63e0527f
commit aaddb8fc55
6 changed files with 12 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ public class LinkDiscoverers {
* @return
*/
public LinkDiscoverer getLinkDiscovererFor(MediaType mediaType) {
return discoverers.getPluginFor(mediaType);
return discoverers.getRequiredPluginFor(mediaType);
}
/**

View File

@@ -96,13 +96,9 @@ public class DelegatingEntityLinks extends AbstractEntityLinks {
*/
private EntityLinks getPluginFor(Class<?> type) {
EntityLinks plugin = delegates.getPluginFor(type);
if (plugin == null) {
throw new IllegalArgumentException(String.format(
"Cannot determine link for %s! No EntityLinks instance found supporting the domain type!", type.getName()));
}
return plugin;
return delegates.getPluginFor(type) //
.orElseThrow(() -> new IllegalArgumentException(
String.format("Cannot determine link for %s! No EntityLinks instance found supporting the domain type!",
type.getName())));
}
}

View File

@@ -38,7 +38,7 @@ public class DelegatingRelProvider implements RelProvider {
*/
@Override
public String getItemResourceRelFor(Class<?> type) {
return providers.getPluginFor(type).getItemResourceRelFor(type);
return providers.getRequiredPluginFor(type).getItemResourceRelFor(type);
}
/*
@@ -47,7 +47,7 @@ public class DelegatingRelProvider implements RelProvider {
*/
@Override
public String getCollectionResourceRelFor(java.lang.Class<?> type) {
return providers.getPluginFor(type).getCollectionResourceRelFor(type);
return providers.getRequiredPluginFor(type).getCollectionResourceRelFor(type);
}
/*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2017 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.
@@ -48,7 +48,7 @@ public class ControllerRelProvider implements RelProvider {
*/
@Override
public String getCollectionResourceRelFor(Class<?> resource) {
return providers.getPluginFor(entityType).getCollectionResourceRelFor(resource);
return providers.getRequiredPluginFor(entityType).getCollectionResourceRelFor(resource);
}
/*
@@ -57,7 +57,7 @@ public class ControllerRelProvider implements RelProvider {
*/
@Override
public String getItemResourceRelFor(Class<?> resource) {
return providers.getPluginFor(entityType).getItemResourceRelFor(resource);
return providers.getRequiredPluginFor(entityType).getItemResourceRelFor(resource);
}
/*