Package kalix.javasdk.view
Class View<S>
Object
kalix.javasdk.view.View<S>
- Type Parameters:
S- The type of the state for this view.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceConstruct the effect that is returned by the command handler. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid_internalSetUpdateContext(Optional<UpdateContext> context) INTERNAL APIvoid_internalSetViewState(S state) INTERNAL APIprotected final View.UpdateEffect.Builder<S>effects()The default implementation of this method returnsnull.protected final UpdateContextAdditional context and metadata for an update handler.protected final SReturns the view state (row) for this invocation as currently stored in Kalix.
-
Constructor Details
-
View
public View()
-
-
Method Details
-
updateContext
Additional context and metadata for an update handler.It will throw an exception if accessed from constructor.
-
_internalSetUpdateContext
INTERNAL API -
_internalSetViewState
INTERNAL API -
viewState
Returns the view state (row) for this invocation as currently stored in Kalix.Note that modifying the state directly will not update it in storage. To save the state, one must call {
effects().updateState()}.This method can only be called when handling a command. Calling it outside a method (eg: in the constructor) will raise a IllegalStateException exception.
- Throws:
IllegalStateException- if accessed outside a handler method
-
effects
-
emptyState
The default implementation of this method returnsnull. It can be overridden to return a more sensible initial state.- Returns:
- an empty state object or `null` to hand to the process method when an event for a previously unknown subject id is seen.
-