Package com.mojang.serialization.codecs
Class UnboundedMapCodec<K,V>
java.lang.Object
com.mojang.serialization.codecs.UnboundedMapCodec<K,V>
- All Implemented Interfaces:
Codec<Map<K,
,V>> BaseMapCodec<K,
,V> Decoder<Map<K,
,V>> Encoder<Map<K,
V>>
public final class UnboundedMapCodec<K,V>
extends Object
implements BaseMapCodec<K,V>, Codec<Map<K,V>>
- Mojang-Added Docs:
Key and value decoded independently, unknown set of keys
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mojang.serialization.Codec
Codec.ResultFunction<A>
Nested classes/interfaces inherited from interface com.mojang.serialization.Decoder
Decoder.Boxed<A>, Decoder.Simple<A>, Decoder.Terminal<A>
-
Field Summary
Fields inherited from interface com.mojang.serialization.Codec
BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> DataResult<Pair<Map<K,
V>, T>> decode
(DynamicOps<T> ops, T input) Decodes an object from a serialized form, returning any remaining serialized data.<T> DataResult<T>
encode
(Map<K, V> input, DynamicOps<T> ops, T prefix) Encodes an object to a serialized form, adding to an existing prefix.boolean
int
hashCode()
keyCodec()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.serialization.codecs.BaseMapCodec
decode, encode
Methods inherited from interface com.mojang.serialization.Codec
comapFlatMap, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, fieldOf, flatComapMap, flatXmap, listOf, mapResult, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, partialDispatch, promotePartial, stable, withLifecycle, xmap
Methods inherited from interface com.mojang.serialization.Decoder
boxed, decode, flatMap, map, parse, parse, simple, terminal
Methods inherited from interface com.mojang.serialization.Encoder
comap, encodeStart, flatComap
-
Constructor Details
-
UnboundedMapCodec
-
-
Method Details
-
keyCodec
- Specified by:
keyCodec
in interfaceBaseMapCodec<K,
V>
-
elementCodec
- Specified by:
elementCodec
in interfaceBaseMapCodec<K,
V>
-
decode
Description copied from interface:Decoder
Decodes an object from a serialized form, returning any remaining serialized data.- Specified by:
decode
in interfaceDecoder<K>
- Type Parameters:
T
- the type of the serialized form- Parameters:
ops
- aDynamicOps
for the serialized forminput
- the serialized form to decode- Returns:
- a
DataResult
containing the decoded object and any remaining serialized data, or an error if the object could not be decoded
-
encode
Description copied from interface:Encoder
Encodes an object to a serialized form, adding to an existing prefix.- Specified by:
encode
in interfaceEncoder<K>
- Type Parameters:
T
- the type to serialize to- Parameters:
input
- the object to encodeops
- aDynamicOps
for the target serialized formatprefix
- existing data that the encoded object should be added to- Returns:
- a
DataResult
containing the serialized form of the object, or an error if the object could not be serialized
-
equals
-
hashCode
public int hashCode() -
toString
-