org.sfm.datastax.impl.setter.ConverterToTupleValueMapper 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.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;
}
}