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

org.sfm.datastax.impl.setter.ConverterToUDTValueMapper 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.UDTValue;
import com.datastax.driver.core.UserType;
import org.sfm.map.Mapper;
import org.sfm.utils.conv.Converter;

public class ConverterToUDTValueMapper implements Converter {

    private final Mapper mapper;
    private final UserType userType;

    public ConverterToUDTValueMapper(Mapper mapper, UserType userType) {
        this.mapper = mapper;
        this.userType = userType;
    }

    @Override
    public UDTValue convert(I in) throws Exception {
        if (in == null) return null;
        UDTValue udtValue = userType.newValue();
        mapper.mapTo(in, udtValue, null);
        return udtValue;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy