Hide CodecContext methods
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / CaseCodecContext.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.dom.codec.impl;
9
10 import java.util.List;
11 import org.opendaylight.mdsal.binding.runtime.api.CaseRuntimeType;
12 import org.opendaylight.yangtools.yang.binding.DataObject;
13 import org.opendaylight.yangtools.yang.binding.DataObjectStep;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17
18 final class CaseCodecContext<D extends DataObject> extends DataObjectCodecContext<D, CaseRuntimeType> {
19     CaseCodecContext(final CaseCodecPrototype prototype) {
20         super(prototype, CodecItemFactory.of(prototype.javaClass()));
21     }
22
23     @Override
24     void addYangPathArgument(final List<PathArgument> builder, final DataObjectStep<?> step) {
25         // NOOP
26     }
27
28     @Override
29     public D deserialize(final NormalizedNode data) {
30         return createBindingProxy(checkDataArgument(ChoiceNode.class, data));
31     }
32
33     @Override
34     public PathArgument serializePathArgument(final DataObjectStep<?> step) {
35         if (step != null) {
36             throw new IllegalArgumentException("Unexpected argument " + step);
37         }
38         return null;
39     }
40
41     @Override
42     public DataObjectStep<?> deserializePathArgument(final PathArgument arg) {
43         if (arg != null) {
44             throw new IllegalArgumentException("Unexpected argument " + arg);
45         }
46         return null;
47     }
48 }