Interface MqttContentParser<T extends NamedBean>


public interface MqttContentParser<T extends NamedBean>
Interface defining a content parser, which translates to and from the MQTT payload content.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beanFromPayload(T bean, String payload, String topic)
    Load a bean's state from a received MQTT payload.
    payloadFromBean(T bean, int newState)
    Create the payload for a particular state transformation on a particular bean.
  • Method Details

    • beanFromPayload

      void beanFromPayload(@Nonnull T bean, @Nonnull String payload, @Nonnull String topic)
      Load a bean's state from a received MQTT payload.
      Parameters:
      bean - The particular item receiving the payload
      payload - The entire string received via MQTT
      topic - MQTT topic.
      Throws:
      IllegalArgumentException - if the payload is unparsable.
    • payloadFromBean

      @Nonnull String payloadFromBean(@Nonnull T bean, int newState)
      Create the payload for a particular state transformation on a particular bean.
      Parameters:
      bean - The particular item sending the payload
      newState - The value to be sent to the layout; this is not yet present in the bean
      Returns:
      String payload to transfer via MQTT.