Merge branch 'master' of ../controller
[yangtools.git] / yang / rfc8528-data-api / src / main / java / org / opendaylight / yangtools / rfc8528 / data / api / MountPointChild.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech s.r.o. 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.yangtools.rfc8528.data.api;
9
10 import com.google.common.annotations.Beta;
11 import java.io.IOException;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizableAnydata;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17
18 /**
19  * An unresolved child within a mount point. This is similar in functionality to {@link NormalizableAnydata}, but
20  * rather than normalizing, the data is fed into a combination of a SchemaContext and NormalizedNodeStreamWriter.
21  */
22 @Beta
23 @NonNullByDefault
24 public interface MountPointChild {
25     /**
26      * Stream this child into a writer, with the help of a SchemaContext.
27      *
28      * @param writer Writer to emit the child into
29      * @param mountCtx MountPointContext for normalization purposes
30      * @throws IOException if an underlying error occurs
31      * @throws NullPointerException if any of the arguments is null
32      */
33     void writeTo(NormalizedNodeStreamWriter writer, MountPointContext mountCtx) throws IOException;
34
35     /**
36      * Normalized this child to a particular SchemaContext.
37      *
38      * @param schemaContext SchemaContext for normalization purposes
39      * @return A NormalizedNode representation of this child
40      * @throws IOException if an underlying error occurs
41      * @throws NullPointerException if any of the arguments is null
42      */
43     NormalizedNode<?, ?> normalizeTo(SchemaContext schemaContext) throws IOException;
44 }