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 com.google.common.base.Preconditions.checkArgument;
12 import org.opendaylight.mdsal.binding.runtime.api.ListRuntimeType;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.Item;
14 import org.opendaylight.yangtools.yang.binding.KeyAware;
17 * A prototype for a {@link MapCodecContext}.
19 final class MapCodecPrototype extends ListCodecPrototype {
20 MapCodecPrototype(final Item<?> item, final ListRuntimeType type, final CodecContextFactory factory) {
21 super(item, type, factory);
22 final var clazz = getBindingClass();
23 checkArgument(KeyAware.class.isAssignableFrom(clazz), "%s is not KeyAware", clazz);
27 ListCodecContext<?> createInstance() {
28 return MapCodecContext.of(this);