Use a switch expressions for enumeration dispatch
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / InsertParam.java
index 6594c6b472b5c4f77dce5f8b1126c0a2f68523a9..521b030b655f3578be7c934ddc2edad740dee220 100644 (file)
@@ -59,18 +59,13 @@ public enum InsertParam implements RestconfQueryParam<InsertParam> {
     }
 
     public static @NonNull InsertParam forUriValue(final String uriValue) {
-        switch (uriValue) {
-            case "after":
-                return AFTER;
-            case "before":
-                return BEFORE;
-            case "first":
-                return FIRST;
-            case "last":
-                return LAST;
-            default:
-                throw new IllegalArgumentException(
-                    "Value can be 'after', 'before', 'first' or 'last', not '" + uriValue + "'");
-        }
+        return switch (uriValue) {
+            case "after" -> AFTER;
+            case "before" -> BEFORE;
+            case "first" -> FIRST;
+            case "last" -> LAST;
+            default -> throw new IllegalArgumentException(
+                "Value can be 'after', 'before', 'first' or 'last', not '" + uriValue + "'");
+        };
     }
 }
\ No newline at end of file