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

org.sfm.datastax.impl.setter.ConverterToTupleValueMapper Maven / Gradle / Ivy

There is a newer version: 8.2.3
Show newest version
package org.sfm.datastax.impl.setter;

import com.datastax.driver.core.TupleType;
import com.datastax.driver.core.TupleValue;
import org.sfm.map.Mapper;
import org.sfm.utils.conv.Converter;

public class ConverterToTupleValueMapper implements Converter {

    private final Mapper mapper;
    private final TupleType tupleType;

    public ConverterToTupleValueMapper(Mapper mapper, TupleType tupleType) {
        this.mapper = mapper;
        this.tupleType = tupleType;
    }

    @Override
    public TupleValue convert(I in) throws Exception {
        if (in == null) return null;
        TupleValue tv = tupleType.newValue();
        mapper.mapTo(in, tv, null);
        return tv;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy