tdlight-java/src/main/java/it/tdlight/client/GenericResultHandler.java
2021-09-27 19:27:13 +02:00

23 lines
461 B
Java

package it.tdlight.client;
import it.tdlight.jni.TdApi;
/**
* Interface for incoming responses from TDLib.
*/
@FunctionalInterface
public interface GenericResultHandler<T extends TdApi.Object> {
/**
* Callback called when TDLib responds.
*/
void onResult(Result<T> result);
default void onResult(TdApi.Object result) {
onResult(Result.of(result));
}
default void onErrorResult(Throwable exception) {
onResult(Result.ofError(exception));
}
}