com.vaadin.signals.impl.

Interface CommandResult

All Known Implementing Classes:

CommandResult.Accept, CommandResult.Reject

public sealed interface CommandResult permits CommandResult.Accept, CommandResult.Reject

The result of applying a signal command against a tree revision. The result is either to accept or reject the command.

See Also:

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 

    An accepted command.

    static final record 

    A data node update in an accepted command result.

    static final record 

    A rejected command, together with the reason for the rejection.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean

    Tests whether this command result is accepted or rejected.

    conditional(boolean condition, String reasonIfFailed)

    Creates an accepted or rejected result depending on the provided condition.

    fail(String reason)

    Creates a new rejected result with the given reason.

    ok()

    Creates a simple accepted result without modifications or original inserts.

    rejectAll(Map<Id,CommandResult> results, String reason)

    Creates a copy of the given map of command results where all accepted results are replaced with the same rejection.

  • Method Details

    • accepted

      boolean accepted()

      Tests whether this command result is accepted or rejected.

      Returns:

      true if the command is accepted, false if it's rejected

    • rejectAll

      static Map<Id,CommandResult> rejectAll(Map<Id,CommandResult> results, String reason)

      Creates a copy of the given map of command results where all accepted results are replaced with the same rejection.

      Parameters:

      results - the original map from ids to command results, not null

      reason - the rejection reason string, not null

      Returns:

      a map with all accepted results replaced with rejections

    • ok

      static CommandResult.Accept ok()

      Creates a simple accepted result without modifications or original inserts.

      Returns:

      the accepted result, not null

    • fail

      static CommandResult.Reject fail(String reason)

      Creates a new rejected result with the given reason.

      Parameters:

      reason - the reason string to use, not null

      Returns:

      a new rejected result, not null

    • conditional

      static CommandResult conditional(boolean condition, String reasonIfFailed)

      Creates an accepted or rejected result depending on the provided condition.

      Parameters:

      condition - the condition to check

      reasonIfFailed - the reason string to use if rejected, not null

      Returns:

      an accepted result if the condition is true, a rejected result if the condition is false