818410dbb3921747b6f1dd691d307add02d9303e
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / AbstractResponseProxy.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 class to use with {@link Response} subclasses.
16  *
17  * @author Robert Varga
18  *
19  * @param <T> Target identifier type
20  * @param <C> Message class
21  */
22 abstract class AbstractResponseProxy<T extends WritableIdentifier, C extends Response<T, C>>
23         extends AbstractMessageProxy<T, C> {
24     @Serial
25     private static final long serialVersionUID = 1L;
26
27     protected AbstractResponseProxy() {
28         // for Externalizable
29     }
30
31     AbstractResponseProxy(final @NonNull C response) {
32         super(response);
33     }
34
35     @Override
36     final C createMessage(final T target, final long sequence) {
37         return createResponse(target, sequence);
38     }
39
40     abstract @NonNull C createResponse(@NonNull T target, long sequence);
41 }