/*
 * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.controller.cluster.raft;

import java.io.Serializable;
import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;

public class ReplicatedLogImplEntry implements ReplicatedLogEntry, Serializable {
    private static final long serialVersionUID = -9085798014576489130L;

    private final long index;
    private final long term;
    private final Payload payload;

    public ReplicatedLogImplEntry(long index, long term, Payload payload) {

        this.index = index;
        this.term = term;
        this.payload = payload;
    }

    @Override
    public Payload getData() {
        return payload;
    }

    @Override
    public long getTerm() {
        return term;
    }

    @Override
    public long getIndex() {
        return index;
    }

    @Override
    public int size() {
        return getData().size();
    }

    @Override
    public String toString() {
        return "Entry{" +
            "index=" + index +
            ", term=" + term +
            '}';
    }
}

@@ -353,16 +353,61 @@
 .raft;%0A%0A
+import com.google.common.base.Preconditions;%0A
 import j
@@ -511,22 +511,84 @@
 yload;%0A%0A
-public
+/**%0A * A %7B@link ReplicatedLogEntry%7D implementation.%0A */%0Apublic final
  class R
@@ -857,16 +857,22 @@
 plEntry(
+final 
 long ind
@@ -874,16 +874,22 @@
 g index,
+ final
  long te
@@ -891,16 +891,22 @@
 ng term,
+ final
  Payload
@@ -917,17 +917,16 @@
 load) %7B%0A
-%0A
         
@@ -994,23 +994,51 @@
 yload = 
+Preconditions.checkNotNull(
 payload
+)
 ;%0A    %7D%0A
@@ -1405,25 +1405,8 @@
 try%7B
-%22 +%0A            %22
 inde
@@ -1418,28 +1418,16 @@
  index +
-%0A           
  %22, term
@@ -1441,20 +1441,8 @@
 rm +
-%0A           
  '%7D'

Make ReplicatedLogImplEntry final