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

group.rxcloud.capa.addons.serialzer.value.parser.LongValueMapParser Maven / Gradle / Ivy

package group.rxcloud.capa.addons.serialzer.value.parser;

import group.rxcloud.capa.addons.serialzer.value.converter.MapValueConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class LongValueMapParser implements ValueParser> {

    public static final LongValueMapParser DEFAULT = new LongValueMapParser();

    private static final Logger _logger = LoggerFactory.getLogger(LongValueMapParser.class);

    private static final MapValueConverter _mapValueConverter = new MapValueConverter<>(
            source -> {
                try {
                    return Long.parseLong(source);
                } catch (Exception ex) {
                    _logger.warn("parse long value failed. long value: {}", source);
                    return null;
                }
            });

    @Override
    public Map parse(String value) {
        Map mapValue = MapParser.DEFAULT.parse(value);
        return _mapValueConverter.convert(mapValue);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy