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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void beanFromPayload​(T bean, java.lang.String payload, java.lang.String topic)
      Load a bean's state from a received MQTT payload.
      java.lang.String payloadFromBean​(T bean, int newState)
      Create the payload for a particular state transformation on a particular bean.
    • Method Detail

      • beanFromPayload

        void beanFromPayload​(@Nonnull
                             T bean,
                             @Nonnull
                             java.lang.String payload,
                             @Nonnull
                             java.lang.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:
        java.lang.IllegalArgumentException - if the payload is unparsable.
      • payloadFromBean

        @Nonnull
        java.lang.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.