2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.api.schema.stream;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 * Utility marker interface for {@link NormalizedNodeStreamWriter} implementations which can be reused multiple times
15 * and can expose a {@link NormalizedNode} result of each complete streaming use.
18 * An example of use would be:
20 * ReusableStreamReceiver writer;
21 * final NormalizedNode result;
24 * // pipe events into writer:
25 * writer.startContainer(...);
28 * result = writer.getResult();
35 * Note the writer should always be {@link #reset()} in a {@code finally} block, so that any streaming state is
39 public interface ReusableStreamReceiver extends NormalizedNodeStreamWriter {
41 * Acquire the result of the last streaming session.
43 * @return Result of streaming.
45 NormalizedNode getResult();
48 * Reset this writer to initial state.