2 * Copyright (c) 2022 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.yangtools.yang.model.api.stmt;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.common.Empty;
13 import org.opendaylight.yangtools.yang.common.Ordering;
14 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
15 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 * An {@link EffectiveStatement} which can contain an {@link OrderedByEffectiveStatement}, controlling ordering of
19 * data elements. Absence of an {@code ordered-by} statement implies {@link Ordering#SYSTEM}. YANG statements using
20 * this interface are {@link LeafListEffectiveStatement} and {@link ListEffectiveStatement}.
22 * @param <A> Argument type ({@link Empty} if statement does not have argument.)
23 * @param <D> Class representing declared version of this statement.
26 public interface OrderedByAwareEffectiveStatement<A, D extends DeclaredStatement<A>> extends EffectiveStatement<A, D> {
28 * Return the effective {@link Ordering} of this statement.
30 * @return Effective ordering
32 default @NonNull Ordering ordering() {
33 return findFirstEffectiveSubstatementArgument(OrderedByEffectiveStatement.class).orElse(Ordering.SYSTEM);