2 * Copyright (c) 2023 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.mdsal.binding.dom.codec.impl;
10 import static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.runtime.api.ChoiceRuntimeType;
14 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
18 * A prototype for {@link ChoiceCodecContext}.
20 final class ChoiceCodecPrototype<T extends ChoiceIn<?>>
21 extends DataContainerPrototype<ChoiceCodecContext<T>, ChoiceRuntimeType> {
22 private final @NonNull NodeIdentifier yangArg;
23 private final @NonNull Class<T> javaClass;
25 ChoiceCodecPrototype(final CodecContextFactory contextFactory, final ChoiceRuntimeType runtimeType,
26 final Class<T> javaClass) {
27 super(contextFactory, runtimeType);
28 this.javaClass = requireNonNull(javaClass);
29 yangArg = NodeIdentifier.create(runtimeType.statement().argument());
33 Class<T> javaClass() {
38 NodeIdentifier yangArg() {
43 ChoiceCodecContext<T> createInstance() {
44 return new ChoiceCodecContext<>(this);