Interface IReadAccess<State>
-
- All Known Implementing Classes:
AbstractReadWriteAcces
public interface IReadAccess<State>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIReadAccess.Priority<State>
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <Result> ResultreadOnly(IUnitOfWork<Result,State> work)Gets a read-only copy of the State and executesworkon it.default <Result> ResulttryReadOnly(IUnitOfWork<Result,State> work)Tries to get a read-only copy of the State and executeworkon it.default <Result> ResulttryReadOnly(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult)Tries to get a read-only copy of the State and executeworkon it.default <Result> ResulttryReadOnly(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult, java.util.function.Function<? super java.lang.Exception,? extends Result> exceptionHandler)Tries to get a read-only copy of the State and executeworkon it.
-
-
-
Method Detail
-
readOnly
<Result> Result readOnly(IUnitOfWork<Result,State> work)
Gets a read-only copy of the State and executesworkon it. WARNING: the State passed toworkcan be null. e.g. when reading from a read-only zip/jar entry- Parameters:
work- Work to execute on the State- Returns:
- The result of executing
work - Since:
- 2.7
-
tryReadOnly
default <Result> Result tryReadOnly(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult)
Tries to get a read-only copy of the State and executeworkon it.- Parameters:
work- Work to execute on the StatedefaultResult- Supplies a result in case the State is null- Returns:
- The result of executing
work, or the result of queryingdefaultResultif the State is null - Since:
- 2.14
-
tryReadOnly
default <Result> Result tryReadOnly(IUnitOfWork<Result,State> work)
Tries to get a read-only copy of the State and executeworkon it.- Parameters:
work- Work to execute on the State- Returns:
- The result of executing
work, or null if the State is null - Since:
- 2.15
-
tryReadOnly
default <Result> Result tryReadOnly(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult, java.util.function.Function<? super java.lang.Exception,? extends Result> exceptionHandler)
Tries to get a read-only copy of the State and executeworkon it.- Parameters:
work- Work to execute on the StatedefaultResult- Supplies a result in case the State is nullexceptionHandler- Supplies a result in case an exception is raised during execution- Returns:
- The result of executing
work, the result of queryingdefaultResultif the State is null, or the result of executingexceptionHandlerin case an exception is raised - Since:
- 2.14
-
-