public class DefaultLazyLoader<S,D> extends Object implements LazyLoader<S,D>
DefaultLazyLoader
that only fetches data once. This implementation is not thread-safe
and cached data is assumed to not be shared across different threads to sync state.Constructor and Description |
---|
DefaultLazyLoader(Function<S,D> loader,
Supplier<D> fallback) |
Modifier and Type | Method and Description |
---|---|
D |
get(Supplier<S> sourceSupplier)
Returns data from the given
source . |
public D get(Supplier<S> sourceSupplier)
LazyLoader
source
. Data is only fetched from source
once and only if necessary, it is
up to implementations to decide the momentum to actually fetch data from source.get
in interface LazyLoader<S,D>
sourceSupplier
- the source from where data will be fetched.Copyright © 2021 JBoss by Red Hat. All rights reserved.