Package io.objectbox.reactive
Interface DataTransformer<FROM,TO>
- Type Parameters:
FROM
- Data type this transformer receivesTO
- Type of transformed data
public interface DataTransformer<FROM,TO>
Transforms or processes data before it is given to subscribed
DataObserver
s. A transformer is set via
SubscriptionBuilder.transform(DataTransformer)
.
Note that a transformer is not required to actually "transform" any data. Technically, it's fine to return the same data it received and just do some processing with it.
Threading notes: transformations are executed sequentially on a background thread owned by the subscription publisher. It is OK to perform long lasting operations, however this will block notifications to all other observers until finished.
-
Method Summary
-
Method Details
-
transform
Transforms/processes the given data.- Parameters:
source
- data to be transformed- Returns:
- transformed data
- Throws:
Exception
- Transformers may throw any exceptions, which can be reacted on viaSubscriptionBuilder.onError(ErrorObserver)
.
-