/*
 * 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.datastore.messages;

import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;

public class DataExistsReply implements SerializableMessage {
    public static final Class<ShardTransactionMessages.DataExistsReply> SERIALIZABLE_CLASS =
            ShardTransactionMessages.DataExistsReply.class;

    private static final DataExistsReply TRUE = new DataExistsReply(true, null);
    private static final DataExistsReply FALSE = new DataExistsReply(false, null);
    private static final ShardTransactionMessages.DataExistsReply SERIALIZABLE_TRUE =
            ShardTransactionMessages.DataExistsReply.newBuilder().setExists(true).build();
    private static final ShardTransactionMessages.DataExistsReply SERIALIZABLE_FALSE =
            ShardTransactionMessages.DataExistsReply.newBuilder().setExists(false).build();

    private final boolean exists;

    private DataExistsReply(final boolean exists, final Void dummy) {
        this.exists = exists;
    }

    /**
     * @deprecated Use {@link #create(boolean)} instead.
     * @param exists
     */
    @Deprecated
    public DataExistsReply(final boolean exists) {
        this(exists, null);
    }

    public static DataExistsReply create(final boolean exists) {
        return exists ? TRUE : FALSE;
    }

    public boolean exists() {
        return exists;
    }

    @Override
    public Object toSerializable() {
        return exists ? SERIALIZABLE_TRUE : SERIALIZABLE_FALSE;
    }

    public static DataExistsReply fromSerializable(final Object serializable) {
        ShardTransactionMessages.DataExistsReply o = (ShardTransactionMessages.DataExistsReply) serializable;
        return create(o.getExists());
    }
}

@@ -1343,204 +1343,8 @@
  %7D%0A%0A
-    /**%0A     * @deprecated Use %7B@link #create(boolean)%7D instead.%0A     * @param exists%0A     */%0A    @Deprecated%0A    public DataExistsReply(final boolean exists) %7B%0A        this(exists, null);%0A    %7D%0A%0A
     

Remove deprecated DataExistsReply constructor