Module org.refcodes.mixin
Package org.refcodes.mixin
Interface ResultAccessor<RES,EXC extends Exception>
-
- Type Parameters:
RES
- The type of the result to be used.EXC
- The exception thrown in case no result is available. UseRuntimeException
to prevent forcing a try/catch block.
- All Known Subinterfaces:
ResultAccessor.ResultProperty<RES,EXC>
public interface ResultAccessor<RES,EXC extends Exception>
Provides access to a result property for e.g. key / result pair.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ResultAccessor.ResultBuilder<RES,B extends ResultAccessor.ResultBuilder<RES,B>>
Provides a builder method for a result property returning the builder for applying multiple build operations.static interface
ResultAccessor.ResultMutator<RES>
Extends theResultAccessor
with a setter method.static interface
ResultAccessor.ResultProperty<RES,EXC extends Exception>
Extends theResultAccessor
with a setter method.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description RES
getResult()
Retrieves the result from the result property.boolean
hasResult()
Tests whether there is already result.default void
waitForResult()
Waits for the result.
-
-
-
Method Detail
-
getResult
RES getResult() throws EXC extends Exception
Retrieves the result from the result property. This method may block or throw an exception in case there is none such result. UsehasResult()
to test beforehand whether we already have a result.
-
hasResult
boolean hasResult()
Tests whether there is already result. This method is special as it must not usegetResult()
to test whether there is a result asgetResult()
may block till we have a result or throw an exception in case there is none such result.- Returns:
- True in case there is a HTTP-Response, else false.
-
waitForResult
default void waitForResult()
Waits for the result. This method may block in case there is none such result or an exception has been thrown. UsehasResult()
to test beforehand whether we already have a result. The default implementation just callsgetResult()
(ignoring the return value or any thrown exception), depending on the actual implementation, this method should be overridden in case callinggetResult()
causes resource overhead or doesn't block.
-
-