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 java.util.List;
11 import org.opendaylight.mdsal.binding.runtime.api.CaseRuntimeType;
12 import org.opendaylight.yangtools.binding.lib.ChoiceIn;
13 import org.opendaylight.yangtools.binding.lib.DataObject;
14 import org.opendaylight.yangtools.binding.lib.DataObjectStep;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 final class CaseCodecContext<C extends ChoiceIn<?> & DataObject> extends DataObjectCodecContext<C, CaseRuntimeType> {
20 CaseCodecContext(final CaseCodecPrototype<C> prototype) {
21 super(prototype, prototype.javaClass());
25 void addYangPathArgument(final List<PathArgument> builder, final DataObjectStep<?> step) {
30 public C deserialize(final NormalizedNode data) {
31 return createBindingProxy(checkDataArgument(ChoiceNode.class, data));
35 public PathArgument serializePathArgument(final DataObjectStep<?> step) {
37 throw new IllegalArgumentException("Unexpected argument " + step);
43 public DataObjectStep<?> deserializePathArgument(final PathArgument arg) {
45 throw new IllegalArgumentException("Unexpected argument " + arg);