public class MapCodec<K,V>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I1<T1,O> |
static interface |
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I2<T1,T2,O> |
static interface |
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I3<T1,T2,T3,O> |
static interface |
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I4<T1,T2,T3,T4,O> |
static interface |
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I5<T1,T2,T3,T4,T5,O> |
static interface |
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I6<T1,T2,T3,T4,T5,T6,O> |
| Modifier and Type | Method and Description |
|---|---|
MapCodec<K,V> |
defaulted(java.util.function.Supplier<V> defaultValue,
java.util.function.Predicate<V> skipDefault)
Set the default value for the value codec if the value is not present in the map.
|
<T> Result<V> |
deserialize(DataConverter<T> converter,
T rawMap,
java.util.Map<T,T> map) |
MapCodec<K,V> |
lenient()
Set the field to be lenient.
|
static <K,V> MapCodec<K,V> |
of(K key,
Codec<K> keyCodec,
Codec<V> valueCodec) |
static <T1,T2,T3,T4,T5,T6,O> |
of(MapCodec<?,T1> type1,
java.util.function.Function<O,T1> value1,
MapCodec<?,T2> type2,
java.util.function.Function<O,T2> value2,
MapCodec<?,T3> type3,
java.util.function.Function<O,T3> value3,
MapCodec<?,T4> type4,
java.util.function.Function<O,T4> value4,
MapCodec<?,T5> type5,
java.util.function.Function<O,T5> value5,
MapCodec<?,T6> type6,
java.util.function.Function<O,T6> value6,
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I6<T1,T2,T3,T4,T5,T6,O> generator) |
static <T1,T2,T3,T4,T5,O> |
of(MapCodec<?,T1> type1,
java.util.function.Function<O,T1> value1,
MapCodec<?,T2> type2,
java.util.function.Function<O,T2> value2,
MapCodec<?,T3> type3,
java.util.function.Function<O,T3> value3,
MapCodec<?,T4> type4,
java.util.function.Function<O,T4> value4,
MapCodec<?,T5> type5,
java.util.function.Function<O,T5> value5,
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I5<T1,T2,T3,T4,T5,O> generator) |
static <T1,T2,T3,T4,O> |
of(MapCodec<?,T1> type1,
java.util.function.Function<O,T1> value1,
MapCodec<?,T2> type2,
java.util.function.Function<O,T2> value2,
MapCodec<?,T3> type3,
java.util.function.Function<O,T3> value3,
MapCodec<?,T4> type4,
java.util.function.Function<O,T4> value4,
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I4<T1,T2,T3,T4,O> generator) |
static <T1,T2,T3,O> |
of(MapCodec<?,T1> type1,
java.util.function.Function<O,T1> value1,
MapCodec<?,T2> type2,
java.util.function.Function<O,T2> value2,
MapCodec<?,T3> type3,
java.util.function.Function<O,T3> value3,
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I3<T1,T2,T3,O> generator) |
static <T1,T2,O> Codec<O> |
of(MapCodec<?,T1> type1,
java.util.function.Function<O,T1> value1,
MapCodec<?,T2> type2,
java.util.function.Function<O,T2> value2,
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I2<T1,T2,O> generator) |
static <T1,O> Codec<O> |
of(MapCodec<?,T1> type1,
java.util.function.Function<O,T1> value1,
net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I1<T1,O> generator) |
MapCodec<K,V> |
optionalDefault(java.util.function.Supplier<V> defaultValue)
Set the default value for the value codec if the value is not present in the map.
|
MapCodec<K,V> |
requiredDefault(java.util.function.Supplier<V> defaultValue)
Set the default value for the value codec if the value is not present in the map.
|
<T> Result<T> |
serialize(DataConverter<T> converter,
java.util.Map<T,T> map,
V value) |
public MapCodec<K,V> lenient()
public MapCodec<K,V> optionalDefault(java.util.function.Supplier<V> defaultValue)
defaultValue - The default valuepublic MapCodec<K,V> requiredDefault(java.util.function.Supplier<V> defaultValue)
optionalDefault(Supplier) which skips the serialization.defaultValue - The default valuepublic MapCodec<K,V> defaulted(java.util.function.Supplier<V> defaultValue, java.util.function.Predicate<V> skipDefault)
optionalDefault(Supplier) if the predicate returns true and like requiredDefault(Supplier) if the predicate returns false.defaultValue - The default valueskipDefault - If the value should not be serializedpublic <T> Result<T> serialize(DataConverter<T> converter, java.util.Map<T,T> map, V value)
public <T> Result<V> deserialize(DataConverter<T> converter, T rawMap, java.util.Map<T,T> map)
public static <T1,O> Codec<O> of(MapCodec<?,T1> type1, java.util.function.Function<O,T1> value1, net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I1<T1,O> generator)
public static <T1,T2,O> Codec<O> of(MapCodec<?,T1> type1, java.util.function.Function<O,T1> value1, MapCodec<?,T2> type2, java.util.function.Function<O,T2> value2, net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I2<T1,T2,O> generator)
public static <T1,T2,T3,O> Codec<O> of(MapCodec<?,T1> type1, java.util.function.Function<O,T1> value1, MapCodec<?,T2> type2, java.util.function.Function<O,T2> value2, MapCodec<?,T3> type3, java.util.function.Function<O,T3> value3, net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I3<T1,T2,T3,O> generator)
public static <T1,T2,T3,T4,O> Codec<O> of(MapCodec<?,T1> type1, java.util.function.Function<O,T1> value1, MapCodec<?,T2> type2, java.util.function.Function<O,T2> value2, MapCodec<?,T3> type3, java.util.function.Function<O,T3> value3, MapCodec<?,T4> type4, java.util.function.Function<O,T4> value4, net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I4<T1,T2,T3,T4,O> generator)
public static <T1,T2,T3,T4,T5,O> Codec<O> of(MapCodec<?,T1> type1, java.util.function.Function<O,T1> value1, MapCodec<?,T2> type2, java.util.function.Function<O,T2> value2, MapCodec<?,T3> type3, java.util.function.Function<O,T3> value3, MapCodec<?,T4> type4, java.util.function.Function<O,T4> value4, MapCodec<?,T5> type5, java.util.function.Function<O,T5> value5, net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I5<T1,T2,T3,T4,T5,O> generator)
public static <T1,T2,T3,T4,T5,T6,O> Codec<O> of(MapCodec<?,T1> type1, java.util.function.Function<O,T1> value1, MapCodec<?,T2> type2, java.util.function.Function<O,T2> value2, MapCodec<?,T3> type3, java.util.function.Function<O,T3> value3, MapCodec<?,T4> type4, java.util.function.Function<O,T4> value4, MapCodec<?,T5> type5, java.util.function.Function<O,T5> value5, MapCodec<?,T6> type6, java.util.function.Function<O,T6> value6, net.lenni0451.mcstructs.converter.codec.MapCodecMerger.I6<T1,T2,T3,T4,T5,T6,O> generator)