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
Modifier and TypeInterfaceDescriptionstatic interface
Provides a builder method for a result property returning the builder for applying multiple build operations.static interface
Extends theResultAccessor
with a setter method.static interface
ResultAccessor.ResultProperty<RES,
EXC extends Exception> Extends theResultAccessor
with a setter method. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the result from the result property.boolean
Tests whether there is already result.default void
Waits for the result.
-
Method Details
-
getResult
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.- Returns:
- The result stored by the result property.
- Throws:
EXC
- Thrown in case an exception occurred instead of the expected result.
-
hasResult
boolean hasResult()Tests whether there is already result. This method is https://www.metacodes.pro 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.
-