Class BaseActionMessageProcessor<T,R>

java.lang.Object
net.solarnetwork.ocpp.service.BaseActionMessageProcessor<T,R>
Type Parameters:
T - the message type
R - the result type
All Implemented Interfaces:
ActionMessageProcessor<T,R>

public abstract class BaseActionMessageProcessor<T,R> extends Object implements ActionMessageProcessor<T,R>
An abstract base implementation of ActionMessageProcessor.
Version:
1.1
Author:
matt
  • Field Details

    • log

      protected org.slf4j.Logger log
      A class-level logger.
  • Constructor Details

    • BaseActionMessageProcessor

      public BaseActionMessageProcessor(Class<T> messageType, Class<R> resultType, Set<ocpp.domain.Action> supportedActions)
      Constructor.

      The emptyMessagesAllowed property will be set to false.

      Parameters:
      messageType - the message type
      resultType - the result type
      supportedActions - the supported actions
      Throws:
      IllegalArgumentException - if supportedActions is null
    • BaseActionMessageProcessor

      public BaseActionMessageProcessor(Class<T> messageType, Class<R> resultType, Set<ocpp.domain.Action> supportedActions, boolean emptyMessageAllowed)
      Constructor.
      Parameters:
      messageType - the message type
      resultType - the result type
      supportedActions - the supported actions
      emptyMessageAllowed - true if a null message is allowed
      Throws:
      IllegalArgumentException - if supportedActions is null
      Since:
      1.1
  • Method Details

    • getSupportedActions

      public Set<ocpp.domain.Action> getSupportedActions()
      Description copied from interface: ActionMessageProcessor
      Get the set of supported actions.
      Specified by:
      getSupportedActions in interface ActionMessageProcessor<T,R>
      Returns:
      the set of supported actions; never null
    • isMessageSupported

      public boolean isMessageSupported(ActionMessage<?> message)
      Test if a specific message is supported by this processor.

      This implementation returns true if either:

      1. The messageType is null or emptyMessageAllowed is true and the message.getMessage() is also null.
      2. The messageType is not null and is assignable from message.getMessage().getClass().
      Test if a specific message is supported by this processor.
      Specified by:
      isMessageSupported in interface ActionMessageProcessor<T,R>
      Parameters:
      message - the message
      Returns:
      true if ActionMessageProcessor.processActionMessage(ActionMessage, ActionMessageResultHandler) can handle the given message
    • getMessageType

      public Class<T> getMessageType()
      Get the message type.
      Returns:
      the message type
    • getResultType

      public Class<R> getResultType()
      Get the result type.
      Returns:
      the result type