-
Notifications
You must be signed in to change notification settings - Fork 20
/
Callback.java
32 lines (30 loc) · 1018 Bytes
/
Callback.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Made with all the love in the world
* by scireum in Remshalden, Germany
*
* Copyright by scireum GmbH
* http://www.scireum.de - [email protected]
*/
package sirius.kernel.commons;
/**
* Implements the {@link java.util.function.Consumer} pattern which permits the handler to throw an exception.
* <p>
* This sometimes might simplify exception handling. If this feature is not required use a plain
* {@link java.util.function.Consumer} instead.
*
* @param <T> the type of the object passed to the callback
* @see UnitOfWork
* @see Processor
* @see Producer
*/
@FunctionalInterface
public interface Callback<T> {
/**
* Invokes the callback with <tt>value</tt>
*
* @param value the value to supply to the callback.
* @throws Exception the callee may throw any exception during the computation. Therefore the caller should
* implement proper error handling without relying on specific exception types.
*/
void invoke(T value) throws Exception;
}