Class BridgeComponent

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String name
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String getName()
      abstract Unit onReceive(Message message) Called when a message is received from the web bridge.
      final Unit didReceive(Message message) This passes a received message to onReceive(message), caching it for use with replyTo(event) and receivedMessageFor(event).
      final Unit didStart() This passes the start lifecycle event to onStart().
      final Unit didStop() This passes the stop lifecycle event to onStop().
      Unit onStart() Called when the component's destination starts (and is active) based on its lifecycle events.
      Unit onStop() Called when the component's destination stops (and is inactive) based on its lifecycle events.
      final Boolean replyWith(Message message) Reply to the web with a received message, optionally replacing its event or jsonData.
      final Boolean replyTo(String event) Reply to the web with the last received message for a given event with its original jsonData.
      final Boolean replyTo(String event, String jsonData) Reply to the web with the last received message for a given event, replacing its jsonData.
      final <T extends Any> Boolean replyTo(String event, T data) Reply to the web with the last received message for a given event, replacing its jsonData with encoded json from the provided data object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onReceive

         abstract Unit onReceive(Message message)

        Called when a message is received from the web bridge. Handle the message for its event type for the custom component's behavior.

      • didReceive

         final Unit didReceive(Message message)

        This passes a received message to onReceive(message), caching it for use with replyTo(event) and receivedMessageFor(event).

        NOTE: This should not be called directly from within a component, but is available to use for testing.

      • didStart

         final Unit didStart()

        This passes the start lifecycle event to onStart().

        NOTE: This should not be called directly from within a component, but is available to use for testing.

      • didStop

         final Unit didStop()

        This passes the stop lifecycle event to onStop().

        NOTE: This should not be called directly from within a component, but is available to use for testing.

      • onStart

         Unit onStart()

        Called when the component's destination starts (and is active) based on its lifecycle events. You can use this as an opportunity to update the component's state/view.

      • onStop

         Unit onStop()

        Called when the component's destination stops (and is inactive) based on its lifecycle events. You can use this as an opportunity to update the component's state/view.

      • replyWith

         final Boolean replyWith(Message message)

        Reply to the web with a received message, optionally replacing its event or jsonData.

      • replyTo

         final Boolean replyTo(String event)

        Reply to the web with the last received message for a given event with its original jsonData.

        NOTE: If a message has not been received for the given event, the reply will be ignored.

      • replyTo

         final Boolean replyTo(String event, String jsonData)

        Reply to the web with the last received message for a given event, replacing its jsonData.

        NOTE: If a message has not been received for the given event, the reply will be ignored.

      • replyTo

         final <T extends Any> Boolean replyTo(String event, T data)

        Reply to the web with the last received message for a given event, replacing its jsonData with encoded json from the provided data object.

        NOTE: If a message has not been received for the given event, the reply will be ignored.