Use a switch expressions for enumeration dispatch
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / ContentParam.java
index 35a9248af9f98650c0234f40c3c838db2cd0f326..ba55a9b8a697fc9ee6b7538c9a290ff5cc7f4401 100644 (file)
@@ -55,16 +55,12 @@ public enum ContentParam implements RestconfQueryParam<ContentParam> {
     }
 
     public static @NonNull ContentParam forUriValue(final String uriValue) {
-        switch (uriValue) {
-            case "all":
-                return ALL;
-            case "config":
-                return CONFIG;
-            case "nonconfig":
-                return NONCONFIG;
-            default:
-                throw new IllegalArgumentException(
-                    "Value can be 'all', 'config' or 'nonconfig', not '" + uriValue + "'");
-        }
+        return switch (uriValue) {
+            case "all" -> ALL;
+            case "config" -> CONFIG;
+            case "nonconfig" -> NONCONFIG;
+            default -> throw new IllegalArgumentException(
+                "Value can be 'all', 'config' or 'nonconfig', not '" + uriValue + "'");
+        };
     }
 }