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.yangtools.yang.binding;
10 import static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
16 * A {@link KeyAware}-based step with a {@link #key()}. It equates to a {@code node-identifier} with a
17 * {@code key-predicate}.
20 * @param <T> KeyAware type
22 public record KeyStep<K extends Key<T>, T extends KeyAware<K> & DataObject>(
23 @NonNull Class<T> type,
24 @Nullable Class<? extends DataObject> caseType,
25 @NonNull K key) implements ExactDataObjectStep<T>, KeyAware<K> {
27 NodeStep.checkType(type, true);
28 NodeStep.checkCaseType(caseType);
32 public KeyStep(final @NonNull Class<T> type, final @NonNull K key) {
33 this(type, null, key);