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 org.eclipse.jdt.annotation.Nullable;
11 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeNode;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 * Location specific context for schema nodes, which contains codec specific information to properly serialize
17 * and deserialize from Java YANG Binding data to NormalizedNode data.
20 * Two core subtypes of codec context are available:
22 * <li>{@link ValueNodeCodecContext} for nodes, which do not contain any nested YANG modeled substructures</li>
23 * <li>{@link DataContainerCodecContext} for nodes, which contain nested YANG modeled substructures. These context
24 * nodes contain contexts for their individual children nodes</li>
27 abstract sealed class CodecContext implements BindingCodecTreeNode
28 permits DataContainerCodecContext, ValueNodeCodecContext {
30 * Returns {@link NodeIdentifier} of current node, if applicable.
32 * @return NodeIdentifier of node, or {@code null} if not applicable
34 abstract @Nullable NodeIdentifier getDomPathArgument();
37 * Return the default value object. Implementations of this method are explicitly allowed to throw unchecked
38 * exceptions, which are propagated as-is upwards the stack.
40 * @return The default value object, or null if the default value is not defined.
42 @Nullable Object defaultObject() {
46 abstract Object deserializeObject(NormalizedNode normalizedNode);