#831 - Introduce null handling.

This commit is contained in:
Greg Turnquist
2019-03-05 15:52:52 -06:00
parent c4e1bedec8
commit 40250d1738
71 changed files with 520 additions and 216 deletions

View File

@@ -33,6 +33,7 @@ import java.util.regex.Pattern;
import org.springframework.core.ResolvableType;
import org.springframework.http.HttpMethod;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -238,8 +239,14 @@ public class Link implements Serializable {
*/
public Link andAffordance(HttpMethod httpMethod, ResolvableType inputType, List<QueryParameter> queryMethodParameters,
ResolvableType outputType) {
return andAffordance(httpMethod.toString().toLowerCase() + inputType.resolve().getSimpleName(), httpMethod,
inputType, queryMethodParameters, outputType);
String name = httpMethod.toString().toLowerCase();
if (inputType.resolve() != null) {
name += inputType.resolve().getSimpleName();
}
return andAffordance(name, httpMethod, inputType, queryMethodParameters, outputType);
}
/**
@@ -458,6 +465,7 @@ public class Link implements Serializable {
* @throws IllegalArgumentException if no {@code rel} attribute could be found.
* @return
*/
@Nullable
public static Link valueOf(String element) {
if (!StringUtils.hasText(element)) {