Remove unneeded serialVersionUID fields
[mdsal.git] / binding / yang-binding / src / main / java / org / opendaylight / yangtools / yang / binding / KeyStep.java
1 /*
2  * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.binding;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14
15 /**
16  * A {@link KeyAware}-based step with a {@link #key()}. It equates to a {@code node-identifier} with a
17  * {@code key-predicate}.
18  *
19  * @param <K> Key type
20  * @param <T> KeyAware type
21  */
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> {
26     public KeyStep {
27         NodeStep.checkType(type, true);
28         NodeStep.checkCaseType(caseType);
29         requireNonNull(key);
30     }
31
32     public KeyStep(final @NonNull Class<T> type, final @NonNull K key) {
33         this(type, null, key);
34     }
35 }