Interface IWriteAccess<State>
-
- All Known Implementing Classes:
AbstractReadWriteAcces
public interface IWriteAccess<State>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <Result> Result
modify(IUnitOfWork<Result,State> work)
Modifies the State by executingwork
on it.default <Result> Result
tryModify(IUnitOfWork<Result,State> work)
Tries to modify the State by executingwork
on it.default <Result> Result
tryModify(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult)
Tries to modify the State by executingwork
on it.default <Result> Result
tryModify(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult, java.util.function.Function<? super java.lang.Exception,? extends Result> exceptionHandler)
Tries to modify the State by executingwork
on it.
-
-
-
Method Detail
-
modify
<Result> Result modify(IUnitOfWork<Result,State> work)
Modifies the State by executingwork
on it. WARNING: the State passed towork
can be null.- Parameters:
work
- Work that modifies the State- Returns:
- The result of executing
work
- Since:
- 2.7
-
tryModify
default <Result> Result tryModify(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult)
Tries to modify the State by executingwork
on it.- Parameters:
work
- Work that modifies the StatedefaultResult
- Supplies a result in case the State is null- Returns:
- The result of executing
work
, or the result of queryingdefaultResult
if the State is null - Since:
- 2.14
-
tryModify
default <Result> Result tryModify(IUnitOfWork<Result,State> work)
Tries to modify the State by executingwork
on it.- Parameters:
work
- Work that modifies the State- Returns:
- The result of executing
work
, or null if the State is null - Since:
- 2.15
-
tryModify
default <Result> Result tryModify(IUnitOfWork<Result,State> work, java.util.function.Supplier<? extends Result> defaultResult, java.util.function.Function<? super java.lang.Exception,? extends Result> exceptionHandler)
Tries to modify the State by executingwork
on it.- Parameters:
work
- Work that modifies 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 queryingdefaultResult
if the State is null, or the result of executingexceptionHandler
in case an exception is raised - Since:
- 2.14
-
-