Modernize yang-data-impl
[yangtools.git] / data / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / ImmutableChoiceNodeBuilder.java
index a7b9ab73f9cf44881f57f84553e90e04ace3f297..445191fc2420f0b20241095438a262c5905fa0ff 100644 (file)
@@ -37,11 +37,10 @@ public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNo
     }
 
     public static @NonNull DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create(final ChoiceNode node) {
-        if (!(node instanceof ImmutableChoiceNode)) {
-            throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
+        if (!(node instanceof ImmutableChoiceNode immutableNode)) {
+            throw new UnsupportedOperationException("Cannot initialize from class " + node.getClass());
         }
-
-        return new ImmutableChoiceNodeBuilder((ImmutableChoiceNode)node);
+        return new ImmutableChoiceNodeBuilder(immutableNode);
     }
 
     @Override