@Experimental(value=SOURCE_SINK) public interface Mapper<T>
To Implement a custom mapper you need to: 1) Create an implementation of Mapper
. 2)
Create a SerializableFunction
that instantiates the Mapper
for a given Session,
for an example see DefaultObjectMapperFactory
). 3) Pass this function to CassandraIO.Read.withMapperFactoryFn(SerializableFunction)
in the CassandraIO builder.
Example:
SerializableFunction<Session, Mapper> factory = new MyCustomFactory();
pipeline
.apply(...)
.apply(CassandraIO.<>read()
.withMapperFactoryFn(factory));
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future<java.lang.Void> |
deleteAsync(T entity)
This method is called for each delete event.
|
java.util.Iterator<T> |
map(com.datastax.driver.core.ResultSet resultSet)
This method is called when reading data from Cassandra.
|
java.util.concurrent.Future<java.lang.Void> |
saveAsync(T entity)
This method is called for each save event.
|
java.util.Iterator<T> map(com.datastax.driver.core.ResultSet resultSet)
resultSet
- A resultset containing rows.java.util.concurrent.Future<java.lang.Void> deleteAsync(T entity)
entity
- Entity to be deleted.java.util.concurrent.Future<java.lang.Void> saveAsync(T entity)
entity
- Entity to be saved.