This interface can be one of three things:
- RequestEnvelope, or
- ResponseEnvelope, being one of
- FailureEnvelope
- SuccessEnvelope
Change-Id: I45c2e35867f1deb9a057700c7a4a93d2f2258c15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.WritableObjects;
-public abstract class Envelope<T extends Message<?, ?>> implements Immutable, Serializable {
+public abstract sealed class Envelope<T extends Message<?, ?>> implements Immutable, Serializable
+ permits RequestEnvelope, ResponseEnvelope {
interface SerialForm<T extends Message<?, ?>, E extends Envelope<T>> extends Externalizable {
@NonNull E envelope();
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableObjects;
-public abstract class ResponseEnvelope<T extends Response<?, ?>> extends Envelope<T> {
+public abstract sealed class ResponseEnvelope<T extends Response<?, ?>> extends Envelope<T>
+ permits FailureEnvelope, SuccessEnvelope {
interface SerialForm<T extends Response<?, ?>, E extends ResponseEnvelope<T>> extends Envelope.SerialForm<T, E> {
@Override
default void writeExternal(final ObjectOutput out, final @NonNull E envelope) throws IOException {