blob: 47aa30e2872049a17702f5124bef4f9c2ea7f76c [file] [log] [blame]
Matthias Andreas Benkardb5d657a2022-02-03 21:14:30 +01001// SPDX-FileCopyrightText: © 2021 Matthias Andreas Benkard <code@mail.matthias.benkard.de>
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
Matthias Andreas Benkard31c61e72021-12-16 20:06:39 +01005package eu.mulk.jgvariant.core;
6
Matthias Andreas Benkard25b7f902021-12-17 06:02:11 +01007import org.apiguardian.api.API;
8import org.apiguardian.api.API.Status;
9
Matthias Andreas Benkard31c61e72021-12-16 20:06:39 +010010/**
11 * A dynamically typed GVariant value carrying a {@link Signature} describing its type.
12 *
13 * <p>{@link #value()} can be of one of the following types:
14 *
15 * <ul>
16 * <li>{@link Boolean}
17 * <li>{@link Byte}
18 * <li>{@link Short}
19 * <li>{@link Integer}
20 * <li>{@link Long}
21 * <li>{@link String}
22 * <li>{@link java.util.Optional} (a GVariant {@code Maybe} type)
23 * <li>{@link java.util.List} (a GVariant array)
Matthias Andreas Benkarda66b73d2021-12-18 19:15:52 +010024 * <li>{@code Object[]} (a GVariant structure)
Matthias Andreas Benkardd6a25d12021-12-28 01:13:58 +010025 * <li>{@link java.util.Map} (a dictionary)
Matthias Andreas Benkardcd924f62021-12-28 00:46:06 +010026 * <li>{@link java.util.Map.Entry} (a dictionary entry)
Matthias Andreas Benkardb50fcd02021-12-16 20:17:20 +010027 * <li>{@link Variant} (a nested variant)
Matthias Andreas Benkard31c61e72021-12-16 20:06:39 +010028 * </ul>
29 *
30 * @param signature the signature describing the type of the value.
31 * @param value the value itself; one of {@link Boolean}, {@link Byte}, {@link Short}, {@link
32 * Integer}, {@link Long}, {@link String}, {@link java.util.Optional}, {@link java.util.List},
Matthias Andreas Benkarda66b73d2021-12-18 19:15:52 +010033 * {@code Object[]}, {@link Variant}.
Matthias Andreas Benkard31c61e72021-12-16 20:06:39 +010034 */
Matthias Andreas Benkard25b7f902021-12-17 06:02:11 +010035@API(status = Status.EXPERIMENTAL)
Matthias Andreas Benkard31c61e72021-12-16 20:06:39 +010036public record Variant(Signature signature, Object value) {}