Package com.jtelegram.api.ex.handler
Class DynamicErrorHandler
- java.lang.Object
-
- com.jtelegram.api.ex.handler.DynamicErrorHandler
-
- All Implemented Interfaces:
java.util.function.Consumer<TelegramException>
public class DynamicErrorHandler extends java.lang.Object implements java.util.function.Consumer<TelegramException>
Allows for dynamic listening for Telegram Exceptions. If you register a handler under a given class, it will also listen for any of its subclasses. There can be an arbitrary amount of listeners for a given class. Do not modify the handlers field directly.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(TelegramException e)
static DynamicErrorHandler
create()
<T extends TelegramException>
DynamicErrorHandlerwhen(java.lang.Class<T> clazz, java.util.function.Consumer<T> consumer)
-
-
-
Method Detail
-
create
public static DynamicErrorHandler create()
-
when
public <T extends TelegramException> DynamicErrorHandler when(java.lang.Class<T> clazz, java.util.function.Consumer<T> consumer)
-
accept
public void accept(TelegramException e)
- Specified by:
accept
in interfacejava.util.function.Consumer<TelegramException>
-
-