Interface DataService
- All Known Implementing Classes:
DataSvc
The service is in charge of two data flows: - push, given to consumers - pull, obtained from sources
The mappers facilitate a one way type transformation if needed.
The interface is very abstract about how data is obtained, but here are my general ideas of where the abstraction is coming from. - push cause one or multiple consumers to modify stored data - pull cause one or multiple suppliers to fetch stored data - mappers are stateless type transformers in memory
Example use-case: - PlayerJoinEvent is mapped to a generic event - that generic event is then consumed and mapped until the data is in a database.
- Some kind of data is wanted to place on a web page - It is requested and the suppliers and mappers give the wanted type of data.
Further research needed: - Can this limited type system represent types of data that need parameters (such as differentiate between two servers data)
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescription<A, B> B
<S> Optional<S>
default <S, P> Optional<S>
default <S, P> Optional<S>
<S, P> Optional<S>
<M> DataService
<M> DataService
registerConsumer(Class<M> type, Consumer<M> consumer)
<P, S> DataService
registerDBSupplier(Class<S> type, Class<P> parameterType, Function<P,Query<S>> supplierWithParameter)
<A, B> DataService
registerMapper(Class<A> typeA, Class<B> typeB, Function<A,B> mapper)
<P, S> DataService
registerSupplier(Class<S> type, Class<P> parameterType, Function<P,S> supplierWithParameter)
<S> DataService
registerSupplier(Class<S> type, Supplier<S> supplier)
-
Method Details
-
push
-
pull
-
pull
-
mapTo
-
pull
-
pull
-
registerMapper
-
registerConsumer
-
registerSupplier
-
registerSupplier
<P, S> DataService registerSupplier(Class<S> type, Class<P> parameterType, Function<P,S> supplierWithParameter) -
registerDBSupplier
<P, S> DataService registerDBSupplier(Class<S> type, Class<P> parameterType, Function<P,Query<S>> supplierWithParameter)
-