Package dev.siroshun.event4j.tree
Interface TreeEventService.Factory<K,E,O>
- Type Parameters:
K
- the key typeE
- the event typeO
- the order type
- Enclosing interface:
- TreeEventService<K,
E, O>
public static interface TreeEventService.Factory<K,E,O>
A factory interface to create
TreeEventService
.
The implementation of this interface should be immutable.
-
Method Summary
Modifier and TypeMethodDescription@NotNull TreeEventService<K,
E, O> create()
Creates a newTreeEventService
withListenerExceptionHandler.continueHandler()
.@NotNull TreeEventService<K,
E, O> create
(@NotNull ListenerExceptionHandler<K, E, O> exceptionHandler) Creates a newTreeEventService
with the customListenerExceptionHandler
.<O1 extends Comparable<O1>>
@NotNull TreeEventService.Factory<K,E, O1> defaultOrder
(O1 defaultOrder) Sets theComparator
and the default order.<E1> @NotNull TreeEventService.Factory<K,
E1, O> eventClass
(Class<? extends E1> eventClass) Sets the root event class.<K1> @NotNull TreeEventService.Factory<K1,
E, O> Sets the key class.<O1> @NotNull TreeEventService.Factory<K,
E, O1> orderComparator
(Comparator<? super O1> orderComparator) Sets theComparator
to sort listeners by the specified orders.<O1> @NotNull TreeEventService.Factory<K,
E, O1> orderComparator
(Comparator<? super O1> orderComparator, O1 defaultOrder) Sets theComparator
and the default order.
-
Method Details
-
keyClass
@Contract("_ -> new") @NotNull <K1> @NotNull TreeEventService.Factory<K1,E, keyClassO> (Class<? extends K1> keyClass) Sets the key class.- Type Parameters:
K1
- the new key type- Parameters:
keyClass
- the key class- Returns:
- the new
TreeEventService.Factory
-
eventClass
@Contract("_ -> new") @NotNull <E1> @NotNull TreeEventService.Factory<K,E1, eventClassO> (Class<? extends E1> eventClass) Sets the root event class.- Type Parameters:
E1
- the new event type- Parameters:
eventClass
- the root event class- Returns:
- the new
TreeEventService.Factory
-
orderComparator
@Contract("_ -> new") @NotNull <O1> @NotNull TreeEventService.Factory<K,E, orderComparatorO1> (Comparator<? super O1> orderComparator) Sets theComparator
to sort listeners by the specified orders.- Type Parameters:
O1
- the new order type- Parameters:
orderComparator
- theComparator
to sort listeners by the specified orders- Returns:
- the new
TreeEventService.Factory
-
orderComparator
@Contract("_, _ -> new") @NotNull <O1> @NotNull TreeEventService.Factory<K,E, orderComparatorO1> (Comparator<? super O1> orderComparator, @Nullable O1 defaultOrder) Sets theComparator
and the default order.The default order is used when the order is not specified. If the default value is not null, no nulls passed to
Comparator
; Otherwise, it is possible to pass nulls toComparator
.- Type Parameters:
O1
- the new order type- Parameters:
orderComparator
- theComparator
to sort listeners by the specified ordersdefaultOrder
- the default order that is used when the order is not specified- Returns:
- the new
TreeEventService.Factory
-
defaultOrder
@Contract("_ -> new") @NotNull <O1 extends Comparable<O1>> @NotNull TreeEventService.Factory<K,E, defaultOrderO1> (@NotNull O1 defaultOrder) Sets theComparator
and the default order.The default order is used when the order is not specified. If the default value is not null, no nulls passed to
Comparator
; Otherwise, it is possible to pass nulls toComparator
.- Type Parameters:
O1
- the new order type- Parameters:
defaultOrder
- the default order that is used when the order is not specified- Returns:
- the new
TreeEventService.Factory
-
create
Creates a newTreeEventService
withListenerExceptionHandler.continueHandler()
.- Returns:
- a new
TreeEventService
-
create
@Contract("_ -> new") @NotNull @NotNull TreeEventService<K,E, createO> (@NotNull @NotNull ListenerExceptionHandler<K, E, O> exceptionHandler) Creates a newTreeEventService
with the customListenerExceptionHandler
.- Parameters:
exceptionHandler
- theListenerExceptionHandler
- Returns:
- a new
TreeEventService
-