Skip to content

Commit e912907

Browse files
committed
Adapt to changes in Spring Framework's HttpMethod.
1 parent f8905b6 commit e912907

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/RootResourceInformationToAlpsDescriptorConverter.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -449,35 +449,35 @@ private static String getRepresentationDescriptorId(ResourceMetadata metadata) {
449449

450450
private static String prefix(HttpMethod method) {
451451

452-
switch (method) {
453-
case GET:
454-
return "get-";
455-
case POST:
456-
return "create-";
457-
case DELETE:
458-
return "delete-";
459-
case PUT:
460-
return "update-";
461-
case PATCH:
462-
return "patch-";
463-
default:
464-
throw new IllegalArgumentException(method.name());
452+
if (HttpMethod.GET.equals(method)) {
453+
return "get-";
454+
} else if (HttpMethod.POST.equals(method)) {
455+
return "create-";
456+
} else if (HttpMethod.DELETE.equals(method)) {
457+
return "delete-";
458+
} else if (HttpMethod.PUT.equals(method)) {
459+
return "update-";
460+
} else if (HttpMethod.PATCH.equals(method)) {
461+
return "patch-";
462+
} else {
463+
throw new IllegalArgumentException(method.name());
465464
}
466465
}
467466

468467
private static Type getType(HttpMethod method) {
469468

470-
switch (method) {
471-
case GET:
472-
return Type.SAFE;
473-
case PUT:
474-
case DELETE:
475-
return Type.IDEMPOTENT;
476-
case POST:
477-
case PATCH:
478-
return Type.UNSAFE;
479-
default:
480-
return null;
469+
if (HttpMethod.GET.equals(method)) {
470+
return Type.SAFE;
471+
} else if (HttpMethod.PUT.equals(method)) {
472+
return Type.IDEMPOTENT;
473+
} else if (HttpMethod.DELETE.equals(method)) {
474+
return Type.IDEMPOTENT;
475+
} else if (HttpMethod.POST.equals(method)) {
476+
return Type.UNSAFE;
477+
} else if (HttpMethod.PATCH.equals(method)) {
478+
return Type.UNSAFE;
479+
} else {
480+
return null;
481481
}
482482
}
483483
}

0 commit comments

Comments
 (0)