blob: fd8df28922851537e04ca708e2cac80c1ff0cc8f [file] [log] [blame]
package eu.mulk.jgvariant.ostree;
import eu.mulk.jgvariant.core.Decoder;
import eu.mulk.jgvariant.core.Variant;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
* A wrapper for a set of metadata fields.
*
* <p>Reference: (embedded in other data types)
*
* @param fields a set of metadata fields indexed by name.
*/
public record Metadata(Map<String, Variant> fields) {
private static final Decoder<Metadata> DECODER =
Decoder.ofDictionary(Decoder.ofString(StandardCharsets.UTF_8), Decoder.ofVariant())
.map(Metadata::new);
/**
* Acquires a {@link Decoder} for the enclosing type.
*
* @return a possibly shared {@link Decoder}.
*/
public static Decoder<Metadata> decoder() {
return DECODER;
}
}