public final class SimpleMapCodec<K,V> extends MapCodec<Map<K,V>> implements BaseMapCodec<K,V>
MapCodec.MapCodecCodec<A>, MapCodec.ResultFunction<A>
MapDecoder.Implementation<A>
MapEncoder.Implementation<A>
Constructor and Description |
---|
SimpleMapCodec(Codec<K> keyCodec,
Codec<V> elementCodec,
Keyable keys) |
Modifier and Type | Method and Description |
---|---|
<T> DataResult<Map<K,V>> |
decode(DynamicOps<T> ops,
MapLike<T> input)
Decodes an object from the given map of serialized entries.
|
Codec<V> |
elementCodec() |
<T> RecordBuilder<T> |
encode(Map<K,V> input,
DynamicOps<T> ops,
RecordBuilder<T> prefix)
Encodes the input into a set of record fields that are added to the given builder.
|
boolean |
equals(Object o) |
int |
hashCode() |
Codec<K> |
keyCodec() |
<T> Stream<T> |
keys(DynamicOps<T> ops)
Returns the set of keys this object defines or accepts, serialized to the provided form.
|
String |
toString() |
codec, dependent, deprecated, fieldOf, flatXmap, forGetter, mapResult, of, of, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, setPartial, stable, unit, unit, withLifecycle, xmap
compressor
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
ap, compressedDecode, compressor, decoder, flatMap, map
comap, compressedBuilder, compressor, encoder, flatComap, makeCompressedBuilder
forStrings
public Codec<V> elementCodec()
elementCodec
in interface BaseMapCodec<K,V>
public <T> Stream<T> keys(DynamicOps<T> ops)
Keyable
public <T> DataResult<Map<K,V>> decode(DynamicOps<T> ops, MapLike<T> input)
MapDecoder
DataResult
.decode
in interface BaseMapCodec<K,V>
decode
in interface MapDecoder<Map<K,V>>
T
- The type of the serialized form.ops
- The DynamicOps
instance defining the serialized form.input
- A map or maplike object containing the serialized entries.DataResult
containing the decoded object, or an error if no object could be decoded.MapDecoder.compressedDecode(DynamicOps, Object)
public <T> RecordBuilder<T> encode(Map<K,V> input, DynamicOps<T> ops, RecordBuilder<T> prefix)
MapEncoder
encode
in interface BaseMapCodec<K,V>
encode
in interface MapEncoder<Map<K,V>>
T
- The type of the serialized form.input
- The value to serialize.ops
- The DynamicOps
instance defining the serialized form.prefix
- A RecordBuilder
to add the serialized fields to.