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 static com.google.common.base.Preconditions.checkArgument;
12 import java.util.List;
13 import org.opendaylight.mdsal.binding.runtime.api.CaseRuntimeType;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
18 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20 final class CaseCodecContext<D extends DataObject> extends DataObjectCodecContext<D, CaseRuntimeType> {
21 CaseCodecContext(final CaseCodecPrototype prototype) {
22 super(prototype, CodecItemFactory.of(prototype.getBindingClass()));
26 void addYangPathArgument(final List<YangInstanceIdentifier.PathArgument> builder, final PathArgument arg) {
31 public D deserialize(final NormalizedNode data) {
32 return createBindingProxy(checkDataArgument(ChoiceNode.class, data));
36 protected Object deserializeObject(final NormalizedNode normalizedNode) {
37 return deserialize(normalizedNode);
41 public YangInstanceIdentifier.PathArgument serializePathArgument(final PathArgument arg) {
42 checkArgument(arg == null, "Unexpected argument %s", arg);
47 public PathArgument deserializePathArgument(final YangInstanceIdentifier.PathArgument arg) {
48 checkArgument(arg == null, "Unexpected argument %s", arg);