2 * Copyright (c) 2014 Cisco Systems, Inc. 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 com.google.common.collect.ImmutableMap;
11 import java.lang.reflect.Method;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.loader.BindingClassLoader;
14 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
15 import org.opendaylight.mdsal.binding.runtime.api.ListRuntimeType;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 * Immutable factory, which provides access to runtime context, create leaf nodes and provides path argument codecs.
22 * During lifetime of factory all calls for same arguments to method must return equal result (not necessary same
23 * instance of result).
25 sealed interface CodecContextFactory permits BindingCodecContext {
27 * Returns immutable runtime context associated with this factory.
29 * @return runtime context
31 BindingRuntimeContext getRuntimeContext();
34 * Returns leaf nodes for supplied data container and parent class.
36 * @param type Binding type for which leaves should be loaded.
37 * @param schema Instantiated schema of binding type.
38 * @return Map of local name to leaf node context.
40 ImmutableMap<Method, ValueNodeCodecContext> getLeafNodes(Class<?> type, EffectiveStatement<?, ?> schema);
43 * Returns Path argument codec for list item.
45 * @param listClz Type of list item
46 * @param type Schema of list item
47 * @return Path argument codec for supplied list item.
49 IdentifiableItemCodec getPathArgumentCodec(Class<?> listClz, ListRuntimeType type);
52 * Return the codec loader associated with this factory.
54 * @return A codec loader instance
56 @NonNull BindingClassLoader getLoader();
58 @NonNull DataContainerStreamer<?> getDataContainerStreamer(Class<?> type);
60 DataContainerSerializer getEventStreamSerializer(Class<?> type);