X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2Fhandler%2FFramingMechanismHandlerFactory.java;h=5e16c00f2360cd9e7dc59202fb0231eab8551f54;hb=ab42fe7a71790596125986630dd119dffc668ec5;hp=b233ff9365d84a011dc1901a0ec9cdcbeba7f602;hpb=321824dee8c42ad0647323aebde50d3645e46ca2;p=netconf.git diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/FramingMechanismHandlerFactory.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/FramingMechanismHandlerFactory.java index b233ff9365..5e16c00f23 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/FramingMechanismHandlerFactory.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/FramingMechanismHandlerFactory.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.nettyutil.handler; import io.netty.buffer.ByteBuf; @@ -15,19 +14,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class FramingMechanismHandlerFactory { - private static final Logger LOG = LoggerFactory.getLogger(FramingMechanismHandlerFactory.class); private FramingMechanismHandlerFactory() { // not called - private constructor for utility class } - public static MessageToByteEncoder createHandler(FramingMechanism framingMechanism) { + public static MessageToByteEncoder createHandler(final FramingMechanism framingMechanism) { LOG.debug("{} framing mechanism was selected.", framingMechanism); - if (framingMechanism == FramingMechanism.EOM) { - return new EOMFramingMechanismEncoder(); - } else { - return new ChunkedFramingMechanismEncoder(); - } + return switch (framingMechanism) { + case CHUNK -> new ChunkedFramingMechanismEncoder(); + case EOM -> new EOMFramingMechanismEncoder(); + }; } }