Promote cds-access-api
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / AbstractSuccessProxy.java
1 /*
2  * Copyright (c) 2016 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.cluster.access.concepts;
9
10 import java.io.Serial;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.concepts.WritableIdentifier;
13
14 /**
15  * Abstract Externalizable proxy for use with {@link RequestSuccess} subclasses.
16  *
17  * @param <T> Target identifier type
18  */
19 public abstract class AbstractSuccessProxy<T extends WritableIdentifier, C extends RequestSuccess<T, C>>
20         extends AbstractResponseProxy<T, C> {
21     @Serial
22     private static final long serialVersionUID = 1L;
23
24     protected AbstractSuccessProxy() {
25         // For Externalizable
26     }
27
28     protected AbstractSuccessProxy(final @NonNull C success) {
29         super(success);
30     }
31
32     @Override
33     final C createResponse(final T target, final long sequence) {
34         return createSuccess(target, sequence);
35     }
36
37     protected abstract @NonNull C createSuccess(@NonNull T target, long sequence);
38 }