-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathProducer.java
33 lines (30 loc) · 955 Bytes
/
Producer.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
33
/*
* 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.Supplier} pattern but permits the factory method to throw an exception.
* <p>
* This sometimes might simplify exception handling. If this feature is not required use a plain
* {@link java.util.function.Supplier} instead.
*
* @param <T> the type of results supplied by this producer
* @see UnitOfWork
* @see Callback
* @see Processor
*/
@FunctionalInterface
public interface Producer<T> {
/**
* Gets a result.
*
* @return a result
* @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.
*/
T create() throws Exception;
}