Enforce pcep-spi checkstyle
[bgpcep.git] / pcep / spi / src / main / java / org / opendaylight / protocol / pcep / spi / pojo / SimpleObjectRegistry.java
index a8cfc2d3d5ea31d2000575e62279e1bcf9576a68..2f0d7bff9e2929c217f4b254a938dcb8db5477e5 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import java.util.Optional;
@@ -29,35 +31,36 @@ public final class SimpleObjectRegistry implements ObjectRegistry {
     private final HandlerRegistry<DataContainer, ObjectParser, ObjectSerializer> handlers = new HandlerRegistry<>();
 
     private static final int MAX_OBJECT_TYPE = 15;
-    private static final int MAX_OBJECT_CLASS = 4;   
+    private static final int MAX_OBJECT_CLASS = 4;
+
     private final VendorInformationObjectRegistry viRegistry;
 
     public SimpleObjectRegistry(final VendorInformationObjectRegistry viRegistry) {
         this.viRegistry = viRegistry;
-
     }
 
     private static int createKey(final int objectClass, final int objectType) {
         Preconditions.checkArgument(objectClass >= 0 && objectClass <= Values.UNSIGNED_BYTE_MAX_VALUE);
         Preconditions.checkArgument(objectType >= 0 && objectType <= MAX_OBJECT_TYPE);
-        return (objectClass << MAX_OBJECT_CLASS) | objectType;
+        return objectClass << MAX_OBJECT_CLASS | objectType;
     }
 
     public AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
-        Preconditions.checkArgument(objectClass >= 0 && objectClass <= Values.UNSIGNED_BYTE_MAX_VALUE, "Illegal object class %s",
+        checkArgument(objectClass >= 0 && objectClass <= Values.UNSIGNED_BYTE_MAX_VALUE, "Illegal object class %s",
                 objectClass);
-        Preconditions.checkArgument(objectType >= 0 && objectType <= MAX_OBJECT_TYPE, "Illegal object type %s", objectType);
+        checkArgument(objectType >= 0 && objectType <= MAX_OBJECT_TYPE, "Illegal object type %s", objectType);
         return this.handlers.registerParser(createKey(objectClass, objectType), parser);
     }
 
-    public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
+    public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass,
+            final ObjectSerializer serializer) {
         return this.handlers.registerSerializer(objClass, serializer);
     }
 
     @Override
-    public Object parseObject(final int objectClass, final int objectType, final ObjectHeader header, final ByteBuf buffer)
-            throws PCEPDeserializerException {
-        Preconditions.checkArgument(objectType >= 0 && objectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
+    public Object parseObject(final int objectClass, final int objectType, final ObjectHeader header,
+            final ByteBuf buffer) throws PCEPDeserializerException {
+        checkArgument(objectType >= 0 && objectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final ObjectParser parser = this.handlers.getParser(createKey(objectClass, objectType));
 
         if (parser == null) {
@@ -82,7 +85,8 @@ public final class SimpleObjectRegistry implements ObjectRegistry {
             return;
         }
         serializer.serializeObject(object, buffer);
-    }   
+    }
+
     @Override
     public Optional<? extends Object> parseVendorInformationObject(final EnterpriseNumber enterpriseNumber,
             final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {