Class Parser<T>

java.lang.Object
com.framed.core.Service
com.framed.io.parser.Parser<T>
Type Parameters:
T - the type of raw input this parser decodes
Direct Known Subclasses:
MedibusRealTimeParser, MedibusSlowParser, PythonParser

public abstract class Parser<T> extends Service
Abstract base for services that turn raw input into events published on the event bus.

A parser consumes raw messages of type T (for example a line of text or a binary frame received from a device) and publishes the decoded values as events for downstream services to consume.

  • Constructor Details

    • Parser

      protected Parser(EventBus eventBus)
      Creates a new parser bound to the given event bus.
      Parameters:
      eventBus - the event bus used to publish parsed events
  • Method Details

    • parse

      public abstract void parse(T message, String deviceName)
      Parses a raw input message and publishes the resulting events on the event bus.
      Parameters:
      message - the raw input to parse
      deviceName - the identifier of the device the message originated from