public final class ChangeNotifiers extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> ChangeNotifier<T> |
aggregate(ChangeNotifier<T>... notifiers)
Creates a
ChangeNotifier that aggregates the records provided by a list of notifiers. |
static <T> ChangeNotifier<T> |
aggregate(Iterable<ChangeNotifier<T>> notifiers) |
static <T> ChangeNotifierFactory.RunnableChangeNotifier<T> |
direct(AtomicReference<Set<T>> recordsHolder) |
static <T> ChangeNotifierFactory.RunnableChangeNotifier<T> |
direct(com.google.common.base.Supplier<Set<T>> recordsSupplier)
Create a
ChangeNotifierFactory.RunnableChangeNotifier that directly wraps a set of records given by a
Supplier. |
static <T> boolean |
isInitialEmptyData(Set<T> set)
Use this to determine if the data you get back from a notifier is the initial result of the result of a proper
DNS lookup.
|
static <T> ChangeNotifier<T> |
staticRecords(Set<T> records) |
static <T> ChangeNotifier<T> |
staticRecords(T... records)
Create a
ChangeNotifier with a static set of records. |
public static <T> boolean isInitialEmptyData(Set<T> set)
set - public static <T> ChangeNotifier<T> aggregate(ChangeNotifier<T>... notifiers)
ChangeNotifier that aggregates the records provided by a list of notifiers.
A change event on any of the input notifiers will propagate up the the returned notifier. The set of previous and current records contained in the event will be the union of all records in the input notifiers, before and after the change event.
T - The record typenotifiers - A list of notifiers to aggregatepublic static <T> ChangeNotifier<T> aggregate(Iterable<ChangeNotifier<T>> notifiers)
public static <T> ChangeNotifier<T> staticRecords(T... records)
ChangeNotifier with a static set of records.
This notifier will never generate any change events. Thus any attached
ChangeNotifier.Listener will at most get one initial call to
ChangeNotifier.Listener.onChange(ChangeNotifier.ChangeNotification)
if they are attached with the fire argument set to true.
T - The record typerecords - The records that the notifier will containpublic static <T> ChangeNotifier<T> staticRecords(Set<T> records)
public static <T> ChangeNotifierFactory.RunnableChangeNotifier<T> direct(com.google.common.base.Supplier<Set<T>> recordsSupplier)
ChangeNotifierFactory.RunnableChangeNotifier that directly wraps a set of records given by a
Supplier.
Each call to Runnable.run() will cause the supplier to be polled and regular
change notifications to be triggered.
This implementation is useful for testing components that depend on a
ChangeNotifier.
T - The record typerecordsSupplier - The supplier of recordspublic static <T> ChangeNotifierFactory.RunnableChangeNotifier<T> direct(AtomicReference<Set<T>> recordsHolder)
Copyright © 2017. All rights reserved.