2 * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.restconf.server.spi;
10 import java.io.IOException;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
13 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
17 * The order in which {@link MapEntryNode}s of a particular {@link MapNode} should be emitted in. This is a sealed
18 * internal implementation detail.
20 * @apiNote This contract exposes two singleton implementations, which we could model via an enum. We went the way
21 * of a sealed abstract for two reasons:
22 * - we do not want to expose orderChildren
23 * - we actually do not want to load IterationMapBodyOrder unless requested, so that the JVM does not have
24 * to worry about it unless requested
28 abstract sealed class MapBodyOrder permits DefaultMapBodyOrder, IterationMapBodyOrder {
30 * Order the body of specified node.
32 * @param entry map entry
33 * @return The body in the order it should be written out
35 abstract Iterable<DataContainerChild> orderBody(MapEntryNode entry) throws IOException;