Enforce pcep-spi checkstyle
[bgpcep.git] / pcep / spi / src / main / java / org / opendaylight / protocol / pcep / spi / ObjectHeaderImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.pcep.spi;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
11 import org.opendaylight.yangtools.yang.binding.DataContainer;
12
13 /**
14  * Header parser for PCEP object.
15  */
16 public class ObjectHeaderImpl implements ObjectHeader {
17
18     private final Boolean processed;
19     private final Boolean ignored;
20
21     public ObjectHeaderImpl(final Boolean processed, final Boolean ignore) {
22         this.processed = processed;
23         this.ignored = ignore;
24     }
25
26     @Override
27     public Class<? extends DataContainer> getImplementedInterface() {
28         return ObjectHeader.class;
29     }
30
31     @Override
32     public Boolean isIgnore() {
33         return this.ignored;
34     }
35
36     @Override
37     public Boolean isProcessingRule() {
38         return this.processed;
39     }
40
41     @Override
42     public String toString() {
43         final String objectHeader = "ObjectHeader [objClass="
44                 + ", processed=" + this.processed
45                 + ", ignored=" + this.ignored
46                 + "]";
47         return objectHeader;
48     }
49
50     @Override
51     public int hashCode() {
52         final int prime = 31;
53         int result = 1;
54         result = prime * result + (this.ignored == null ? 0 : this.ignored.hashCode());
55         result = prime * result + (this.processed == null ? 0 : this.processed.hashCode());
56         return result;
57     }
58
59     @Override
60     public boolean equals(final Object obj) {
61         if (this == obj) {
62             return true;
63         }
64         if (obj == null || getClass() != obj.getClass()) {
65             return false;
66         }
67         final ObjectHeaderImpl other = (ObjectHeaderImpl) obj;
68         if (this.ignored == null) {
69             if (other.ignored != null) {
70                 return false;
71             }
72         } else if (!this.ignored.equals(other.ignored)) {
73             return false;
74         }
75         if (this.processed == null) {
76             if (other.processed != null) {
77                 return false;
78             }
79         } else if (!this.processed.equals(other.processed)) {
80             return false;
81         }
82         return true;
83     }
84 }