Matthias Andreas Benkard | b5d657a | 2022-02-03 21:14:30 +0100 | [diff] [blame^] | 1 | // SPDX-FileCopyrightText: © 2021 Matthias Andreas Benkard <code@mail.matthias.benkard.de> |
| 2 | // |
| 3 | // SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 | |
Matthias Andreas Benkard | 31c61e7 | 2021-12-16 20:06:39 +0100 | [diff] [blame] | 5 | package eu.mulk.jgvariant.core; |
| 6 | |
Matthias Andreas Benkard | 25b7f90 | 2021-12-17 06:02:11 +0100 | [diff] [blame] | 7 | import org.apiguardian.api.API; |
| 8 | import org.apiguardian.api.API.Status; |
| 9 | |
Matthias Andreas Benkard | 31c61e7 | 2021-12-16 20:06:39 +0100 | [diff] [blame] | 10 | /** |
| 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 Benkard | a66b73d | 2021-12-18 19:15:52 +0100 | [diff] [blame] | 24 | * <li>{@code Object[]} (a GVariant structure) |
Matthias Andreas Benkard | d6a25d1 | 2021-12-28 01:13:58 +0100 | [diff] [blame] | 25 | * <li>{@link java.util.Map} (a dictionary) |
Matthias Andreas Benkard | cd924f6 | 2021-12-28 00:46:06 +0100 | [diff] [blame] | 26 | * <li>{@link java.util.Map.Entry} (a dictionary entry) |
Matthias Andreas Benkard | b50fcd0 | 2021-12-16 20:17:20 +0100 | [diff] [blame] | 27 | * <li>{@link Variant} (a nested variant) |
Matthias Andreas Benkard | 31c61e7 | 2021-12-16 20:06:39 +0100 | [diff] [blame] | 28 | * </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 Benkard | a66b73d | 2021-12-18 19:15:52 +0100 | [diff] [blame] | 33 | * {@code Object[]}, {@link Variant}. |
Matthias Andreas Benkard | 31c61e7 | 2021-12-16 20:06:39 +0100 | [diff] [blame] | 34 | */ |
Matthias Andreas Benkard | 25b7f90 | 2021-12-17 06:02:11 +0100 | [diff] [blame] | 35 | @API(status = Status.EXPERIMENTAL) |
Matthias Andreas Benkard | 31c61e7 | 2021-12-16 20:06:39 +0100 | [diff] [blame] | 36 | public record Variant(Signature signature, Object value) {} |