Use pattern match on instanceof
[aaa.git] / web / impl-osgi / src / main / java / org / opendaylight / aaa / web / osgi / WhiteboardWebServer.java
index a1b3f1626709ec71404e7b85a2ef2c3712765a83..141a6825daf5e6507a02b61d391c58d876412b8e 100644 (file)
@@ -75,10 +75,10 @@ public final class WhiteboardWebServer implements WebServer {
     @Override
     public String getBaseURL() {
         final var endpoint = serviceRuntime.getProperty(HttpServiceRuntimeConstants.HTTP_SERVICE_ENDPOINT);
-        if (endpoint instanceof String) {
-            return (String) endpoint;
-        } else if (endpoint instanceof String[]) {
-            return getBaseURL(Arrays.asList((String[]) endpoint));
+        if (endpoint instanceof String str) {
+            return str;
+        } else if (endpoint instanceof String[] endpoints) {
+            return getBaseURL(Arrays.asList(endpoints));
         } else if (endpoint instanceof Collection) {
             // Safe as per OSGi Compendium R7 section 140.15.3.1
             @SuppressWarnings("unchecked")