Reduce JSR305 proliferation
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / Response.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 com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.controller.cluster.access.ABIVersion;
13 import org.opendaylight.yangtools.concepts.WritableIdentifier;
14
15 /**
16  * Abstract counterpart to a {@link Request}. This class should not be instantiated directly, but rather through
17  * {@link RequestFailure} and {@link RequestSuccess}, which provide appropriate specialization. It is visible purely for
18  * the purpose of allowing to check if an object is either of those specializations with a single instanceof check.
19  *
20  * @author Robert Varga
21  *
22  * @param <T> Target identifier type
23  * @param <C> Message type
24  */
25 @Beta
26 public abstract class Response<T extends WritableIdentifier, C extends Response<T, C>> extends Message<T, C> {
27     private static final long serialVersionUID = 1L;
28
29     Response(final @NonNull T target, final long sequence) {
30         super(target, sequence);
31     }
32
33     Response(final @NonNull C response, final @NonNull ABIVersion version) {
34         super(response, version);
35     }
36
37     @Override
38     abstract AbstractResponseProxy<T, C> externalizableProxy(ABIVersion version);
39 }