2 * Copyright (c) 2016 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.yangtools.yang.data.util;
10 import java.io.IOException;
11 import org.opendaylight.yangtools.yang.data.api.schema.stream.SchemaAwareNormalizedNodeStreamWriter;
12 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
13 import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
18 * childs - empty augment - only one element can be
21 class ChoiceNodeDataWithSchema extends CompositeNodeDataWithSchema {
23 private CaseNodeDataWithSchema caseNodeDataWithSchema;
25 ChoiceNodeDataWithSchema(final ChoiceSchemaNode schema) {
30 protected CompositeNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
31 CaseNodeDataWithSchema newChild = new CaseNodeDataWithSchema((ChoiceCaseNode) schema);
32 caseNodeDataWithSchema = newChild;
33 addCompositeChild(newChild);
37 public CaseNodeDataWithSchema getCase() {
38 return caseNodeDataWithSchema;
42 public void write(final SchemaAwareNormalizedNodeStreamWriter writer) throws IOException {
43 writer.nextDataSchemaNode(getSchema());
44 writer.startChoiceNode(provideNodeIdentifier(), childSizeHint());