Class BridgeComponent
-
- All Implemented Interfaces:
public abstract class BridgeComponent<D extends BridgeDestination>
-
-
Constructor Summary
Constructors Constructor Description BridgeComponent(String name, BridgeDelegate<D> delegate)
-
Method Summary
Modifier and Type Method Description final StringgetName()abstract UnitonReceive(Message message)Called when a message is received from the web bridge. final UnitdidReceive(Message message)This passes a received message to onReceive(message), caching it for use with replyTo(event) and receivedMessageFor(event). final UnitdidStart()This passes the start lifecycle event to onStart(). final UnitdidStop()This passes the stop lifecycle event to onStop(). UnitonStart()Called when the component's destination starts (and is active) based on its lifecycle events. UnitonStop()Called when the component's destination stops (and is inactive) based on its lifecycle events. final BooleanreplyWith(Message message)Reply to the web with a received message, optionally replacing its eventorjsonData.final BooleanreplyTo(String event)Reply to the web with the last received message for a given eventwith its originaljsonData.final BooleanreplyTo(String event, String jsonData)Reply to the web with the last received message for a given event, replacing itsjsonData.final <T extends Any> BooleanreplyTo(String event, T data)Reply to the web with the last received message for a given event, replacing itsjsonDatawith encoded json from the provideddataobject.-
-
Constructor Detail
-
BridgeComponent
BridgeComponent(String name, BridgeDelegate<D> delegate)
-
-
Method Detail
-
onReceive
abstract Unit onReceive(Message message)
Called when a message is received from the web bridge. Handle the message for its
eventtype 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
eventorjsonData.
-
replyTo
final Boolean replyTo(String event)
Reply to the web with the last received message for a given
eventwith its originaljsonData.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 itsjsonData.NOTE: If a message has not been received for the given
event, the reply will be ignored.
-
-
-
-