Class AbstractConverter

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, Serializable
    Direct Known Subclasses:
    BinaryConverter, DataExchangeServerBasedConverter, FileBasedConverter, StringConverter

    public abstract class AbstractConverter
    extends adams.core.option.AbstractOptionHandler
    implements adams.core.QuickInfoSupporter, adams.flow.core.FlowContextHandler
    Ancestor for converters that convert the data to was received.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.flow.core.Actor m_FlowContext
      the flow context.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      String check​(byte[] payload)
      Hook method for checks.
      Object convert​(byte[] payload, adams.core.MessageCollection errors)
      Converts the payload.
      protected abstract Object doConvert​(byte[] payload, adams.core.MessageCollection errors)
      Converts the payload.
      abstract Class generates()
      Returns the class that the converter generates.
      adams.flow.core.Actor getFlowContext()
      Returns the flow context.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      void setFlowContext​(adams.flow.core.Actor value)
      Sets the flow context.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_FlowContext

        protected transient adams.flow.core.Actor m_FlowContext
        the flow context.
    • Constructor Detail

      • AbstractConverter

        public AbstractConverter()
    • Method Detail

      • setFlowContext

        public void setFlowContext​(adams.flow.core.Actor value)
        Sets the flow context.
        Specified by:
        setFlowContext in interface adams.flow.core.FlowContextHandler
        Parameters:
        value - the context
      • getFlowContext

        public adams.flow.core.Actor getFlowContext()
        Returns the flow context.
        Specified by:
        getFlowContext in interface adams.flow.core.FlowContextHandler
        Returns:
        the context, null if not available
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Default implementation returns null.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • generates

        public abstract Class generates()
        Returns the class that the converter generates.
        Returns:
        the class
      • check

        public String check​(byte[] payload)
        Hook method for checks.
        Parameters:
        payload - the payload to check
        Returns:
        null if sucessfully checked, otherwise error message
      • doConvert

        protected abstract Object doConvert​(byte[] payload,
                                            adams.core.MessageCollection errors)
        Converts the payload.
        Parameters:
        payload - the payload
        errors - for recording errors
        Returns:
        null if failed to convert, otherwise byte array
      • convert

        public Object convert​(byte[] payload,
                              adams.core.MessageCollection errors)
        Converts the payload.
        Parameters:
        payload - the payload
        errors - for recording errors
        Returns:
        null if failed to convert, otherwise byte array