Package org.wildfly.clustering.function
Interface Consumer<T>
- Type Parameters:
T- the accepted type
- All Superinterfaces:
Consumer<T>
- All Known Implementing Classes:
Consumer.ExceptionLogger
An enhanced unary consumer.
- Author:
- Paul Ferraro
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Consumer<?> static final Function<System.Logger.Level, Consumer<Exception>> static final Map<System.Logger.Level, Consumer<Exception>> static final Map<System.Logger.Level, Consumer<AutoCloseable>> -
Method Summary
Modifier and TypeMethodDescriptionstatic <V extends AutoCloseable>
Consumer<V> close()Returns a consumer that silently closes its object.static <V extends AutoCloseable>
Consumer<V> Returns a consumer that silently closes its object using the specified exception handler.default <V> Consumer<V> Returns a mapped consumer, that invokes this consumer using result of the specified function.debug()Returns a consumer that logs an exception at theSystem.Logger.Level.DEBUGlevel.static <V> Consumer<V> empty()Returns a consumer that performs no action.error()Returns a consumer that logs an exception at theSystem.Logger.Level.ERRORlevel.info()Returns a consumer that logs an exception at theSystem.Logger.Level.INFOlevel.log(System.Logger.Level level) Returns a consumer that logs an exception at the specified level.static <V> Consumer<V> Returns a composite consumer that delegates to zero or more consumers.static <V> Consumer<V> Returns a consumer that runs the specified task, ignoring its parameter.warning()Returns a consumer that logs an exception at theSystem.Logger.Level.WARNINGlevel.
-
Field Details
-
EMPTY
-
EXCEPTION_LOGGERS
-
EXCEPTION_LOGGER
-
SILENT_CLOSERS
-
-
Method Details
-
andThen
-
compose
Returns a mapped consumer, that invokes this consumer using result of the specified function.- Type Parameters:
V- the mapped type- Parameters:
mapper- a mapping function- Returns:
- a mapped consumer
-
empty
Returns a consumer that performs no action.- Type Parameters:
V- the consumed type- Returns:
- an empty consumer
-
close
Returns a consumer that silently closes its object.- Type Parameters:
V- the auto-closeable type- Returns:
- an closing consumer
-
log
Returns a consumer that logs an exception at the specified level.- Parameters:
level- the log level- Returns:
- an exception logging consumer
-
error
Returns a consumer that logs an exception at theSystem.Logger.Level.ERRORlevel.- Returns:
- an exception logging consumer
-
warning
Returns a consumer that logs an exception at theSystem.Logger.Level.WARNINGlevel.- Returns:
- an exception logging consumer
-
info
Returns a consumer that logs an exception at theSystem.Logger.Level.INFOlevel.- Returns:
- an exception logging consumer
-
debug
Returns a consumer that logs an exception at theSystem.Logger.Level.DEBUGlevel.- Returns:
- an exception logging consumer
-
close
Returns a consumer that silently closes its object using the specified exception handler.- Type Parameters:
V- the auto-closeable type- Parameters:
handler- an exception handler- Returns:
- a silent closing consumer
-
of
Returns a consumer that runs the specified task, ignoring its parameter.- Type Parameters:
V- the ignored parameter type- Parameters:
task- a runnable task- Returns:
- a consumer that runs the specified task, ignoring its parameter.
-
of
Returns a composite consumer that delegates to zero or more consumers.- Type Parameters:
V- the consumed type- Parameters:
consumers- zero or more consumers- Returns:
- a composite consumer
-