All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tarantool.driver.mappers.DefaultMapValueConverter Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.mappers;

import org.msgpack.value.MapValue;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * Default {@link MapValue} converter to {@link Map} converter
 *
 * @author Alexey Kuzin
 */
public class DefaultMapValueConverter implements ValueConverter> {

    private MessagePackValueMapper mapper;

    public DefaultMapValueConverter(MessagePackValueMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public Map fromValue(MapValue value) {
        return value.map().entrySet().stream()
                .collect(Collectors.toMap(e -> mapper.fromValue(e.getKey()), e -> mapper.fromValue(e.getValue())));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy