A - The type that this MapEncoder serializes.public interface MapEncoder<A> extends Keyable
A MapEncoder is a specialization of a Encoder that operates on some defined set of record keys.
 While a MapEncoder does not implement Encoder, any MapEncoder may be turned into a
 Encoder by calling the encoder() method.
 
Implementations of MapEncoder are immutable once created. The methods defined in this interface never
 mutate the decoder in a way visible to the outside.
Encoder, 
MapCodec| Modifier and Type | Interface and Description | 
|---|---|
static class  | 
MapEncoder.Implementation<A>
A class that implements both  
MapEncoder and Compressable. | 
| Modifier and Type | Method and Description | 
|---|---|
default <B> MapEncoder<B> | 
comap((? super B) -> ? extends A function)
Transforms this map encoder to operate on a different type using the given mapping function. 
 | 
default <T> RecordBuilder<T> | 
compressedBuilder(DynamicOps<T> ops)
Creates a new, empty  
RecordBuilder that accepts values of the given serialized type. | 
<T> KeyCompressor<T> | 
compressor(DynamicOps<T> ops)
Returns the  
KeyCompressor this map encoder uses to associate valid record keys with indices. | 
<T> RecordBuilder<T> | 
encode(A input,
      DynamicOps<T> ops,
      RecordBuilder<T> prefix)
Encodes the input into a set of record fields that are added to the given builder. 
 | 
default Encoder<A> | 
encoder()
Returns the  
Encoder that implements the operations defined in this MapEncoder. | 
default <B> MapEncoder<B> | 
flatComap((? super B) -> ? extends DataResult<? extends A> function)
Transforms this map encoder to operate on a different type using the given partial mapping function. 
 | 
static <T> RecordBuilder<T> | 
makeCompressedBuilder(DynamicOps<T> ops,
                     KeyCompressor<T> compressor)
Creates a  
RecordBuilder that serializes a fixed set of keys defined by the KeyCompressor. | 
default MapEncoder<A> | 
withLifecycle(Lifecycle lifecycle)
Sets the  
Lifecycle of the results this map encoder serializes. | 
forStrings, keys<T> RecordBuilder<T> encode(A input, DynamicOps<T> ops, RecordBuilder<T> prefix)
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.default <T> RecordBuilder<T> compressedBuilder(DynamicOps<T> ops)
RecordBuilder that accepts values of the given serialized type. The returned
 builder will used compressed keys if and only if the serialized type uses compressed keys.makeCompressedBuilder(DynamicOps, KeyCompressor) if
 the given DynamicOps prefers compressed keys, and returns DynamicOps.mapBuilder() otherwise.T - The type of the serialized form.ops - The DynamicOps instance defining the serialized form.RecordBuilder.DynamicOps.compressMaps()<T> KeyCompressor<T> compressor(DynamicOps<T> ops)
KeyCompressor this map encoder uses to associate valid record keys with indices.T - The type of the serialized form.ops - The DynamicOps instance defining the serialized form.KeyCompressor for this map encoder.default <B> MapEncoder<B> comap((? super B) -> ? extends A function)
MapEncoder.Implementation that wraps this map encoder.B - The new type.function - A function from the new type to the current type.default <B> MapEncoder<B> flatComap((? super B) -> ? extends DataResult<? extends A> function)
MapEncoder.Implementation that wraps this map encoder.B - The new type.function - A function from the new type to the current type.default Encoder<A> encoder()
Encoder that implements the operations defined in this MapEncoder.Encoder that implements the Encoder.encode(Object, DynamicOps, Object)
 method to call encode(Object, DynamicOps, RecordBuilder).default MapEncoder<A> withLifecycle(Lifecycle lifecycle)
Lifecycle of the results this map encoder serializes.MapEncoder.Implementation that wraps this map decoder.lifecycle - The lifecycle to use.static <T> RecordBuilder<T> makeCompressedBuilder(DynamicOps<T> ops, KeyCompressor<T> compressor)
RecordBuilder that serializes a fixed set of keys defined by the KeyCompressor.T - The type of the serialized form.ops - The DynamicOps instance defining the serialized form.compressor - A KeyCompressor the returned builder uses to compress valid keys.RecordBuilder that uses the given compressor to serialize compressed keys.