Merge "Fix test case mis-spelling."
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / registry / gossip / BucketImpl.java
1 /*
2  * Copyright (c) 2014 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.controller.remote.rpc.registry.gossip;
9
10 import java.io.Serializable;
11
12 public class BucketImpl<T extends Copier<T>> implements Bucket<T>, Serializable {
13     private static final long serialVersionUID = 1L;
14
15     private Long version = System.currentTimeMillis();
16
17     private T data;
18
19     public BucketImpl() {
20     }
21
22     public BucketImpl(T data) {
23         this.data = data;
24     }
25
26     public BucketImpl(Bucket<T> other) {
27         this.version = other.getVersion();
28         this.data = other.getData();
29     }
30
31     public void setData(T data) {
32         this.data = data;
33         this.version = System.currentTimeMillis()+1;
34     }
35
36     @Override
37     public Long getVersion() {
38         return version;
39     }
40
41     @Override
42     public T getData() {
43         return data;
44     }
45
46     @Override
47     public String toString() {
48         return "BucketImpl{" +
49                 "version=" + version +
50                 ", data=" + data +
51                 '}';
52     }
53 }