Promote MessageRegistry to pcep-api
[bgpcep.git] / pcep / base-parser / src / main / java / org / opendaylight / protocol / pcep / parser / subobject / GeneralizedLabelParser.java
index 715e1ca2cf42cde614aeb0b9cc8a667d845e37cf..55fc017fdd2783c69828c3a4cbc58944d7507ea9 100644 (file)
@@ -7,13 +7,15 @@
  */
 package org.opendaylight.protocol.pcep.parser.subobject;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.LabelParser;
 import org.opendaylight.protocol.pcep.spi.LabelSerializer;
 import org.opendaylight.protocol.pcep.spi.LabelUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase;
@@ -30,8 +32,7 @@ public class GeneralizedLabelParser implements LabelParser, LabelSerializer {
 
     @Override
     public LabelType parseLabel(final ByteBuf buffer) throws PCEPDeserializerException {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(),
-                "Array of bytes is mandatory. Can't be null or empty.");
+        checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
         return new GeneralizedLabelCaseBuilder()
                 .setGeneralizedLabel(
                         new GeneralizedLabelBuilder().setGeneralizedLabel(ByteArray.readAllBytes(buffer)).build())
@@ -41,7 +42,7 @@ public class GeneralizedLabelParser implements LabelParser, LabelSerializer {
     @Override
     public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject,
             final ByteBuf buffer) {
-        Preconditions.checkArgument(subobject instanceof GeneralizedLabelCase,
+        checkArgument(subobject instanceof GeneralizedLabelCase,
                 "Unknown Label Subobject instance. Passed {}. Needed GeneralizedLabelCase.", subobject.getClass());
         final GeneralizedLabel gl = ((GeneralizedLabelCase) subobject).getGeneralizedLabel();
         Preconditions.checkArgument(gl != null, "GeneralizedLabel is mandatory.");