org.sfm.datastax.impl.setter.SetWithConverterSettableDataSetter Maven / Gradle / Ivy
package org.sfm.datastax.impl.setter;
import com.datastax.driver.core.SettableByIndexData;
import org.sfm.reflect.Setter;
import org.sfm.utils.conv.Converter;
import java.util.HashSet;
import java.util.Set;
public class SetWithConverterSettableDataSetter implements Setter, Set> {
private final int index;
private final Converter converter;
public SetWithConverterSettableDataSetter(int index, Converter converter) {
this.index = index;
this.converter = converter;
}
@Override
public void set(SettableByIndexData> target, Set value) throws Exception {
if (value == null) {
target.setToNull(index);
} else {
Set list = new HashSet(value.size());
for(I i : value) {
list.add(converter.convert(i));
}
target.setSet(index, list);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy