BUG-3823 : fixed Sonar issues for PCEP/programming
[bgpcep.git] / pcep / spi / src / main / java / org / opendaylight / protocol / pcep / spi / ObjectHeaderImpl.java
index 2bc841848734bc88e6ef85edb1e65c54a4309276..65724a6832508c2ffb0207e6d907d2056064efae 100644 (file)
@@ -15,68 +15,73 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  */
 public class ObjectHeaderImpl implements ObjectHeader {
 
-       private final boolean processed;
-       private final boolean ignored;
+    private final Boolean processed;
+    private final Boolean ignored;
 
-       public ObjectHeaderImpl(final boolean processed, final boolean ignore) {
-               this.processed = processed;
-               this.ignored = ignore;
-       }
+    public ObjectHeaderImpl(final Boolean processed, final Boolean ignore) {
+        this.processed = processed;
+        this.ignored = ignore;
+    }
 
-       @Override
-       public Class<? extends DataContainer> getImplementedInterface() {
-               return ObjectHeader.class;
-       }
+    @Override
+    public Class<? extends DataContainer> getImplementedInterface() {
+        return ObjectHeader.class;
+    }
 
-       @Override
-       public Boolean isIgnore() {
-               return this.ignored;
-       }
+    @Override
+    public Boolean isIgnore() {
+        return this.ignored;
+    }
 
-       @Override
-       public Boolean isProcessingRule() {
-               return this.processed;
-       }
+    @Override
+    public Boolean isProcessingRule() {
+        return this.processed;
+    }
 
-       @Override
-       public String toString() {
-               final StringBuilder builder = new StringBuilder();
-               builder.append("ObjectHeader [objClass=");
-               builder.append(", processed=");
-               builder.append(this.processed);
-               builder.append(", ignored=");
-               builder.append(this.ignored);
-               builder.append("]");
-               return builder.toString();
-       }
+    @Override
+    public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ObjectHeader [objClass=");
+        builder.append(", processed=");
+        builder.append(this.processed);
+        builder.append(", ignored=");
+        builder.append(this.ignored);
+        builder.append("]");
+        return builder.toString();
+    }
 
-       @Override
-       public int hashCode() {
-               final int prime = 31;
-               int result = 1;
-               result = prime * result + (this.ignored ? 1231 : 1237);
-               result = prime * result + (this.processed ? 1231 : 1237);
-               return result;
-       }
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((this.ignored == null) ? 0 : this.ignored.hashCode());
+        result = prime * result + ((this.processed == null) ? 0 : this.processed.hashCode());
+        return result;
+    }
 
-       @Override
-       public boolean equals(final Object obj) {
-               if (this == obj) {
-                       return true;
-               }
-               if (obj == null) {
-                       return false;
-               }
-               if (this.getClass() != obj.getClass()) {
-                       return false;
-               }
-               final ObjectHeaderImpl other = (ObjectHeaderImpl) obj;
-               if (this.ignored != other.ignored) {
-                       return false;
-               }
-               if (this.processed != other.processed) {
-                       return false;
-               }
-               return true;
-       }
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        final ObjectHeaderImpl other = (ObjectHeaderImpl) obj;
+        if (this.ignored == null) {
+            if (other.ignored != null) {
+                return false;
+            }
+        } else if (!this.ignored.equals(other.ignored)) {
+            return false;
+        }
+        if (this.processed == null) {
+            if (other.processed != null) {
+                return false;
+            }
+        } else if (!this.processed.equals(other.processed)) {
+            return false;
+        }
+        return true;
+    }
 }