2 * Copyright (c) 2024 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.codec.gson;
10 import java.io.IOException;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
14 * A handler used to write out JSON-encoded values.
17 public interface JSONValueWriter {
19 * Write a {@code boolean} value, as per
20 * <a href="https://www.rfc-editor.org/rfc/rfc7951#section-6.3">RFC7951, section 6.3</a>.
22 * @param value Value to write
23 * @throws IOException when an IO error occurs
25 void writeBoolean(boolean value) throws IOException;
28 * Write an {@code empty} value, as per
29 * <a href="https://www.rfc-editor.org/rfc/rfc7951#section-6.9">RFC7951, section 6.9</a>.
31 * @throws IOException when an IO error occurs
33 void writeEmpty() throws IOException;
36 * Write a numeric value, as per
37 * <a href="https://www.rfc-editor.org/rfc/rfc7951#section-6.1">RFC7951, section 6.1</a>.
39 * @param value Value to write
40 * @throws IOException when an IO error occurs
42 void writeNumber(Number value) throws IOException;
45 * Write a string value, as per
46 * <a href="https://www.rfc-editor.org/rfc/rfc7951#section-6.2">RFC7951, section 6.2</a> and other types which have
47 * are represented as JSON strings.
49 * @param value Value to write
50 * @throws IOException when an IO error occurs
52 void writeString(String value) throws IOException;