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 static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
15 * A serialized JSON string, indicating what kind of value it represents.
17 * @param rawString unescaped string
18 * @param kind string kind
21 public record JSONValue(String rawString, Kind kind) {
23 * The kind of a {@link JSONValue}. Indicates the semantics of {@link JSONValue#rawString()}.
27 * A {@code boolean} value.
31 * An {@code empty} value.
35 * A numeric value, excluding {@code int64} and {@code uint64)}.
45 * The equivalent on {@link Boolean#FALSE}.
47 public static final JSONValue FALSE = new JSONValue("false", Kind.BOOLEAN);
49 * The equivalent on {@link Boolean#TRUE}.
51 public static final JSONValue TRUE = new JSONValue("true", Kind.BOOLEAN);
53 * The equivalent on {@link org.opendaylight.yangtools.yang.common.Empty#value()}.
55 public static final JSONValue EMPTY = new JSONValue("[null]", Kind.EMPTY);
58 requireNonNull(rawString);