e471be2d1025f32cca52fa236be134511d794cf9
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / NodeCacheManagerEvent.java
1 /*
2  * Copyright (C) 2015 Red Hat, Inc.
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  * Authors : Flavio Fernandes
9  */
10 package org.opendaylight.ovsdb.openstack.netvirt;
11
12 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
13
14 public class NodeCacheManagerEvent extends AbstractEvent {
15
16     private String nodeIdentifier;
17
18     public NodeCacheManagerEvent(String nodeIdentifier, Action action) {
19         super(HandlerType.NODE, action);
20         this.nodeIdentifier = nodeIdentifier;
21     }
22
23     public String getNodeIdentifier() {
24         return nodeIdentifier;
25     }
26
27     @Override
28     public String toString() {
29         return "NodeCacheManagerEvent [action=" + super.getAction()
30                + ", nodeIdentifier=" + nodeIdentifier
31                + "]";
32     }
33
34     @Override
35     public int hashCode() {
36         final int prime = 31;
37         int result = super.hashCode();
38         result = prime * result + ((nodeIdentifier == null) ? 0 : nodeIdentifier.hashCode());
39         return result;
40     }
41
42     @Override
43     public boolean equals(Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (obj == null) {
48             return false;
49         }
50         if (getClass() != obj.getClass()) {
51             return false;
52         }
53         if (!super.equals(obj)) {
54             return false;
55         }
56         NodeCacheManagerEvent other = (NodeCacheManagerEvent) obj;
57         if (nodeIdentifier == null) {
58             if (other.nodeIdentifier != null) {
59                 return false;
60             }
61         } else if (!nodeIdentifier.equals(other.nodeIdentifier)) {
62             return false;
63         }
64         return true;
65     }
66 }