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.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.CompositeRuntimeType;
14 import org.opendaylight.yangtools.yang.binding.DataContainer;
17 * A prototype for codecs dealing with {@link DataContainer}s.
19 * @param <C> {@link CodecContext} type
20 * @param <R> {@link CompositeRuntimeType} type
22 abstract sealed class DataContainerPrototype<C extends CodecContext, R extends CompositeRuntimeType>
23 extends LazyCodecContextSupplier<C> permits CommonDataObjectCodecPrototype {
24 private final @NonNull CodecContextFactory contextFactory;
25 private final @NonNull R runtimeType;
27 DataContainerPrototype(final CodecContextFactory contextFactory, final R runtimeType) {
28 this.contextFactory = requireNonNull(contextFactory);
29 this.runtimeType = requireNonNull(runtimeType);
33 * Return the {@link CodecContextFactory} associated with this prototype.
35 * @return the context factory associated with this prototype
37 final @NonNull CodecContextFactory contextFactory() {
38 return contextFactory;
42 * Return associated run-time type.
44 * @return associated run-time type
46 final @NonNull R runtimeType() {
51 * Return the generated binding class this prototype corresponds to.
53 * @return the generated binding class this prototype corresponds to
55 abstract @NonNull Class<? extends DataContainer> javaClass();