Migrate AbstractRegistration/AutoCloseable
[bgpcep.git] / bmp / bmp-spi / src / main / java / org / opendaylight / protocol / bmp / spi / registry / SimpleBmpTlvRegistry.java
index 81478525a6c871bc9233db26f4ccdc768bf1c18a..be1b7b64c8f58d60373034c65944b4d7f28e81b0 100644 (file)
@@ -5,10 +5,10 @@
  * 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.protocol.bmp.spi.registry;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bmp.spi.parser.BmpDeserializationException;
 import org.opendaylight.protocol.bmp.spi.parser.BmpTlvParser;
@@ -17,6 +17,7 @@ import org.opendaylight.protocol.bmp.spi.parser.BmpTlvSerializer;
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.util.Values;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev180329.Tlv;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,7 +40,7 @@ public class SimpleBmpTlvRegistry implements BmpTlvRegistry {
 
     @Override
     public Tlv parseTlv(final int tlvType, final ByteBuf buffer) throws BmpDeserializationException {
-        Preconditions.checkArgument(tlvType >= 0 && tlvType <= Values.UNSIGNED_SHORT_MAX_VALUE);
+        checkArgument(tlvType >= 0 && tlvType <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final BmpTlvParser parser = this.handlers.getParser(tlvType);
         if (parser == null) {
             LOG.warn("BMP parser for TLV type {} is not registered.", tlvType);
@@ -49,13 +50,13 @@ public class SimpleBmpTlvRegistry implements BmpTlvRegistry {
     }
 
     @Override
-    public AutoCloseable registerBmpTlvParser(final int tlvType, final BmpTlvParser parser) {
-        Preconditions.checkArgument(tlvType >= 0 && tlvType < Values.UNSIGNED_SHORT_MAX_VALUE);
+    public Registration registerBmpTlvParser(final int tlvType, final BmpTlvParser parser) {
+        checkArgument(tlvType >= 0 && tlvType < Values.UNSIGNED_SHORT_MAX_VALUE);
         return this.handlers.registerParser(tlvType, parser);
     }
 
     @Override
-    public AutoCloseable registerBmpTlvSerializer(final Class<? extends Tlv> tlvClass,
+    public Registration registerBmpTlvSerializer(final Class<? extends Tlv> tlvClass,
             final BmpTlvSerializer serializer) {
         return this.handlers.registerSerializer(tlvClass, serializer);
     }