org.sfm.datastax.impl.setter.ConverterToUDTValueMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-datastax Show documentation
Show all versions of sfm-datastax Show documentation
Cassandra Datastax SFM supports.
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;
}
}