![JAR search and dependency download from the Maven repository](/logo.png)
kikaha.uworkers.api.Response Maven / Gradle / Ivy
package kikaha.uworkers.api;
import java.util.function.BiConsumer;
import lombok.RequiredArgsConstructor;
/**
* Represents a response promise from a given task sent to a Worker.
*/
public interface Response {
/**
* Awaits for a response to come.
*
* @return
*/
RESP response();
/**
* Awaits for a response to come.
*
* @param targetClass
* @return
*/
RESP responseAs( Class targetClass );
/**
* Attach a listener that will be notified when the response is available.
*
* @param listener
* @return
*/
Response then( BiConsumer listener );
/**
* Store an object which its class is not initially known. It allow developers
* to as the held object to a more convenient type more easily.
*/
@RequiredArgsConstructor
class UndefinedObject {
final Object object;
public T as(Class type ) {
return (T) object;
}
public T get() { return (T)object; }
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy