Bump MDSAL to 4.0.0
[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
12 /**
13  * Header parser for PCEP object.
14  */
15 public class ObjectHeaderImpl implements ObjectHeader {
16
17     private final Boolean processed;
18     private final Boolean ignored;
19
20     public ObjectHeaderImpl(final Boolean processed, final Boolean ignore) {
21         this.processed = processed;
22         this.ignored = ignore;
23     }
24
25     @Override
26     public Class<ObjectHeader> implementedInterface() {
27         return ObjectHeader.class;
28     }
29
30     @Override
31     public Boolean isIgnore() {
32         return this.ignored;
33     }
34
35     @Override
36     public Boolean isProcessingRule() {
37         return this.processed;
38     }
39
40     @Override
41     public String toString() {
42         final String objectHeader = "ObjectHeader [objClass="
43                 + ", processed=" + this.processed
44                 + ", ignored=" + this.ignored
45                 + "]";
46         return objectHeader;
47     }
48
49     @Override
50     public int hashCode() {
51         final int prime = 31;
52         int result = 1;
53         result = prime * result + (this.ignored == null ? 0 : this.ignored.hashCode());
54         result = prime * result + (this.processed == null ? 0 : this.processed.hashCode());
55         return result;
56     }
57
58     @Override
59     public boolean equals(final Object obj) {
60         if (this == obj) {
61             return true;
62         }
63         if (obj == null || getClass() != obj.getClass()) {
64             return false;
65         }
66         final ObjectHeaderImpl other = (ObjectHeaderImpl) obj;
67         if (this.ignored == null) {
68             if (other.ignored != null) {
69                 return false;
70             }
71         } else if (!this.ignored.equals(other.ignored)) {
72             return false;
73         }
74         if (this.processed == null) {
75             if (other.processed != null) {
76                 return false;
77             }
78         } else if (!this.processed.equals(other.processed)) {
79             return false;
80         }
81         return true;
82     }
83 }