Class StatefulHandler.StatefulHandlerInvoker

java.lang.Object
io.fluxzero.sdk.tracking.handling.StatefulHandler.StatefulHandlerInvoker
Enclosing class:
StatefulHandler

protected class StatefulHandler.StatefulHandlerInvoker extends Object
  • Field Details

    • delegate

      protected final io.fluxzero.common.handling.HandlerInvoker delegate
  • Constructor Details

    • StatefulHandlerInvoker

      public StatefulHandlerInvoker(io.fluxzero.common.handling.HandlerInvoker delegate, Entry<?> currentEntry, DeserializingMessage message)
  • Method Details

    • invoke

      public Object invoke(BiFunction<Object,Object,Object> combiner)
    • handleResult

      protected void handleResult(Object result)
      Applies stateful persistence semantics to a handler invocation result.

      Supported result forms:

      • Collection<?>: stores every same-type instance in the collection. If the collection is empty, the current entry is deleted. If the current entry ID is not part of returned IDs, the current entry is deleted.
      • null: deletes the current entry only when the invoked method is expected to return handler state (same/assignable handler type).
      • Single object: stores it only if it is assignable to the handler type. If the stored ID differs from the current ID, the current entry is deleted (replacement behavior).
    • tryStoreResult

      protected Object tryStoreResult(Object result)
      Stores a result object if it is assignable to the stateful handler type.
      Parameters:
      result - object returned from a handler method
      Returns:
      the computed/stored handler ID, or null if the result is not a stateful handler instance
    • computeId

      protected Object computeId(Object handler)
    • getTargetClass

      public Class<?> getTargetClass()
    • getMethod

      public Executable getMethod()
    • getMethodAnnotation

      public <A extends Annotation> A getMethodAnnotation()
    • expectResult

      public boolean expectResult()
    • isPassive

      public boolean isPassive()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • andFinally

      default io.fluxzero.common.handling.HandlerInvoker andFinally(io.fluxzero.common.handling.HandlerInvoker arg0)
    • invoke

      default Object invoke()