Bump versions to 14.0.0-SNAPSHOT
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / DataObjectCodecPrototype.java
1 /*
2  * Copyright (c) 2023 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.mdsal.binding.dom.codec.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.runtime.api.CompositeRuntimeType;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.DataObjectStep;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
18
19 abstract sealed class DataObjectCodecPrototype<T extends CompositeRuntimeType> extends CommonDataObjectCodecPrototype<T>
20         permits CaseCodecPrototype, ContainerLikeCodecPrototype, ListCodecPrototype,
21                 NotificationCodecContext.Prototype {
22     private final @NonNull NodeIdentifier yangArg;
23
24     DataObjectCodecPrototype(final Class<?> cls, final NodeIdentifier yangArg, final T type,
25             final CodecContextFactory factory) {
26         this(InstanceIdentifier.createStep(cls.asSubclass(DataObject.class)), yangArg, type, factory);
27     }
28
29     DataObjectCodecPrototype(final DataObjectStep<?> bindingArg, final NodeIdentifier yangArg, final T type,
30             final CodecContextFactory factory) {
31         super(bindingArg, type, factory);
32         this.yangArg = requireNonNull(yangArg);
33     }
34
35     @Override
36     final NodeIdentifier yangArg() {
37         return yangArg;
38     }
39 }