Package com.onec.ui

Record Class ActionResult

java.lang.Object
java.lang.Record
com.onec.ui.ActionResult
Record Components:
message - a toast to show (success), or null
navigate - an onec:// url to route to afterwards, or null
refresh - whether to reload the current list/detail surface

public record ActionResult(String message, String navigate, boolean refresh) extends Record
What the client does after a server-side action runs: optionally show a message, navigate to a route, and/or refresh the current surface. Returned by an ActionSpec handler.
  • Constructor Details

    • ActionResult

      public ActionResult(String message, String navigate, boolean refresh)
      Creates an instance of a ActionResult record class.
      Parameters:
      message - the value for the message record component
      navigate - the value for the navigate record component
      refresh - the value for the refresh record component
  • Method Details

    • ok

      public static ActionResult ok()
      Did nothing observable — just acknowledge.
    • message

      public static ActionResult message(String message)
      Show a success toast.
    • refresh

      public static ActionResult refresh(String message)
      Show a toast and reload the current surface (the common "it changed data" case).
    • redirect

      public static ActionResult redirect(String url)
      Send the top-level browser to an external url (a full-page navigation, not a new tab) — e.g. kicking off an OAuth "Connect with X" consent screen so the provider can redirect back. The url is passed verbatim after the onec://redirect/ scheme, so it may carry a query string.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • refresh

      public boolean refresh()
      Returns the value of the refresh record component.
      Returns:
      the value of the refresh record component