4de24263b874a6c2cf17d421faba28ff2bbc6e92
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / AbstractEnvelopeProxy.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 static com.google.common.base.Verify.verifyNotNull;
11 import static java.util.Objects.requireNonNull;
12
13 @Deprecated(since = "7.0.0", forRemoval = true)
14 abstract class AbstractEnvelopeProxy<T extends Message<?, ?>, E extends Envelope<T>>
15         implements Envelope.SerialForm<T, E> {
16     @java.io.Serial
17     private static final long serialVersionUID = 1L;
18
19     private E envelope;
20
21     AbstractEnvelopeProxy() {
22         // for Externalizable
23     }
24
25     AbstractEnvelopeProxy(final E envelope) {
26         this.envelope = requireNonNull(envelope);
27     }
28
29     @Override
30     public final E envelope() {
31         return verifyNotNull(envelope);
32     }
33
34     @Override
35     public final void setEnvelope(final E envelope) {
36         this.envelope = requireNonNull(envelope);
37     }
38
39     @Override
40     public final Object readResolve() {
41         return envelope();
42     }
43 }