2 * Copyright (c) 2017 Pantheon Technologies 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.javav2.dom.codec.impl.context;
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Preconditions;
12 import java.util.List;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.mdsal.binding.javav2.dom.codec.impl.context.base.DataContainerCodecPrototype;
15 import org.opendaylight.mdsal.binding.javav2.dom.codec.impl.context.base.TreeNodeCodecContext;
16 import org.opendaylight.mdsal.binding.javav2.spec.base.TreeArgument;
17 import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
20 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
21 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
22 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
25 * Codec context for serializing and deserializing choice case node and it's
32 public final class CaseNodeCodecContext<D extends TreeNode> extends TreeNodeCodecContext<D, ChoiceCaseNode> {
35 * Prepare context for choice case node from prototype.
38 * - codec prototype of choice case node
40 public CaseNodeCodecContext(final DataContainerCodecPrototype<ChoiceCaseNode> prototype) {
44 @SuppressWarnings("rawtypes")
46 protected void addYangPathArgument(final TreeArgument arg, final List<PathArgument> builder) {
47 // add your implementation
52 public D deserialize(@Nonnull final NormalizedNode<?, ?> normalizedNode) {
53 Preconditions.checkState(normalizedNode instanceof ChoiceNode);
54 return createBindingProxy((ChoiceNode) normalizedNode);
58 protected Object deserializeObject(final NormalizedNode<?, ?> normalizedNode) {
59 return deserialize(normalizedNode);
62 @SuppressWarnings("rawtypes")
64 public PathArgument serializePathArgument(final TreeArgument arg) {
65 Preconditions.checkArgument(arg == null);
69 @SuppressWarnings("rawtypes")
71 public TreeArgument deserializePathArgument(final YangInstanceIdentifier.PathArgument arg) {
72 Preconditions.checkArgument(arg == null);