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 subscribedDataObserver
s. A transformer is set viaSubscriptionBuilder.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TO
transform(FROM source)
Transforms/processes the given data.
-
-
-
Method Detail
-
transform
TO transform(FROM source) throws java.lang.Exception
Transforms/processes the given data.- Parameters:
source
- data to be transformed- Returns:
- transformed data
- Throws:
java.lang.Exception
- Transformers may throw any exceptions, which can be reacted on viaSubscriptionBuilder.onError(ErrorObserver)
.
-
-