Do not override dependency plugin version
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / entityownership / messages / EntityOwnershipChanged.java
1 /*
2  * Copyright (c) 2015 Brocade Communications 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.controller.cluster.datastore.entityownership.messages;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
12
13 /**
14  * Message encapsulating an entity ownership change.
15  *
16  * @author Thomas Pantelis
17  */
18 public class EntityOwnershipChanged {
19     private final Entity entity;
20     private final boolean wasOwner;
21     private final boolean isOwner;
22
23     public EntityOwnershipChanged(Entity entity, boolean wasOwner, boolean isOwner) {
24         this.entity = Preconditions.checkNotNull(entity, "entity can't be null");
25         this.wasOwner = wasOwner;
26         this.isOwner = isOwner;
27     }
28
29     public Entity getEntity() {
30         return entity;
31     }
32
33     public boolean wasOwner() {
34         return wasOwner;
35     }
36
37     public boolean isOwner() {
38         return isOwner;
39     }
40
41     @Override
42     public String toString() {
43         return "EntityOwnershipChanged [entity=" + entity + ", wasOwner=" + wasOwner + ", isOwner=" + isOwner + "]";
44     }
45 }