X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pcep%2Fspi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fpcep%2Fspi%2Fpojo%2FSimpleTlvRegistry.java;h=d37b8cb07d66219e1049fe3d4d1be6733276dfd2;hb=2f3cf555f60c85d54af16d9d8d8f4e55523db2c3;hp=1b718ef93f3426811ff50d3760e61588888cc050;hpb=6c99f76fe988deda9ff81a52fdda3c0301c3d5ad;p=bgpcep.git diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java index 1b718ef93f..d37b8cb07d 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java @@ -7,7 +7,8 @@ */ package org.opendaylight.protocol.pcep.spi.pojo; -import com.google.common.base.Preconditions; +import static com.google.common.base.Preconditions.checkArgument; + import io.netty.buffer.ByteBuf; import org.opendaylight.protocol.concepts.HandlerRegistry; import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException; @@ -16,24 +17,25 @@ import org.opendaylight.protocol.pcep.spi.TlvRegistry; import org.opendaylight.protocol.pcep.spi.TlvSerializer; import org.opendaylight.protocol.util.Values; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv; +import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.DataContainer; public final class SimpleTlvRegistry implements TlvRegistry { private final HandlerRegistry handlers = new HandlerRegistry<>(); - public AutoCloseable registerTlvParser(final int tlvType, final TlvParser parser) { - Preconditions.checkArgument(tlvType >= 0 && tlvType < Values.UNSIGNED_SHORT_MAX_VALUE); + public Registration registerTlvParser(final int tlvType, final TlvParser parser) { + checkArgument(tlvType >= 0 && tlvType < Values.UNSIGNED_SHORT_MAX_VALUE); return this.handlers.registerParser(tlvType, parser); } - public AutoCloseable registerTlvSerializer(final Class tlvClass, final TlvSerializer serializer) { + public Registration registerTlvSerializer(final Class tlvClass, final TlvSerializer serializer) { return this.handlers.registerSerializer(tlvClass, serializer); } @Override public Tlv parseTlv(final int type, final ByteBuf buffer) throws PCEPDeserializerException { - Preconditions.checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE); + checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE); final TlvParser parser = this.handlers.getParser(type); if (parser == null) { return null;