Java 17 and sonar fixes.
[policy/drools-applications.git] / controlloop / common / controller-usecases / src / main / java / org / onap / policy / drools / apps / controller / usecases / GetTargetEntityOperation2.java
index f9d90af..29689ed 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -92,16 +93,11 @@ public class GetTargetEntityOperation2 extends OperationPartial {
             throw new IllegalArgumentException("The target type is null");
         }
 
-        switch (targetType) {
-            case PNF:
-                return detmPnfTarget();
-            case VM:
-            case VNF:
-            case VFMODULE:
-                return detmVfModuleTarget();
-            default:
-                throw new IllegalArgumentException("The target type is not supported");
-        }
+        return switch (targetType) {
+            case PNF -> detmPnfTarget();
+            case VM, VNF, VFMODULE -> detmVfModuleTarget();
+            default -> throw new IllegalArgumentException("The target type is not supported");
+        };
     }
 
     /**