4e9f9cb373cc7c764218df8a1c1a2da58b193e9d
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / SwitchShardBehavior.java
1 /*
2  * Copyright (c) 2015 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
9 package org.opendaylight.controller.cluster.datastore.messages;
10
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.cluster.raft.RaftState;
13
14 public final class SwitchShardBehavior {
15     private final String shardName;
16     private final RaftState newState;
17     private final long term;
18
19     public SwitchShardBehavior(String shardName, RaftState newState, long term) {
20         this.shardName = Preconditions.checkNotNull(shardName);
21         this.newState = Preconditions.checkNotNull(newState);
22         this.term = term;
23     }
24
25     public String getShardName() {
26         return shardName;
27     }
28
29     public RaftState getNewState() {
30         return newState;
31     }
32
33     public long getTerm() {
34         return term;
35     }
36
37     @Override
38     public String toString() {
39         final StringBuilder sb = new StringBuilder("SwitchShardBehavior{");
40         sb.append("shardName='").append(shardName).append('\'');
41         sb.append(", newState='").append(newState).append('\'');
42         sb.append(", term=").append(term);
43         sb.append('}');
44         return sb.toString();
45     }
46 }