From 23d130981f5357ef7da53710df5be12728ad6204 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 17 Aug 2022 09:42:35 +0200 Subject: [PATCH] Add SSv1 Add a serialization proxy for SingletonSet, so that we have explicit control over the format. Change-Id: Iedf53fe200215fbe1236464677e42b7d27d0caf5 Signed-off-by: Robert Varga (cherry picked from commit 3e086972fad7b1d81b8a9d3e4ed0f84f2e8822fe) --- .../org/opendaylight/yangtools/util/SSv1.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 common/util/src/main/java/org/opendaylight/yangtools/util/SSv1.java diff --git a/common/util/src/main/java/org/opendaylight/yangtools/util/SSv1.java b/common/util/src/main/java/org/opendaylight/yangtools/util/SSv1.java new file mode 100644 index 0000000000..e0481b5744 --- /dev/null +++ b/common/util/src/main/java/org/opendaylight/yangtools/util/SSv1.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.util; + +import java.io.Serializable; + +/** + * Serialization proxy for {@link SingletonSet}. + */ +final class SSv1 implements Serializable { + private static final long serialVersionUID = 1; + + private final Object element; + + SSv1(final Object element) { + this.element = element; + } + + private Object readResolve() { + return SingletonSet.of(element); + } +} -- 2.36.6