Package net.solarnetwork.ocpp.service
Class BaseActionMessageProcessor<T,R>
java.lang.Object
net.solarnetwork.ocpp.service.BaseActionMessageProcessor<T,R>
- Type Parameters:
T- the message typeR- 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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBaseActionMessageProcessor(Class<T> messageType, Class<R> resultType, Set<ocpp.domain.Action> supportedActions) Constructor.BaseActionMessageProcessor(Class<T> messageType, Class<R> resultType, Set<ocpp.domain.Action> supportedActions, boolean emptyMessageAllowed) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGet the message type.Get the result type.Set<ocpp.domain.Action>Get the set of supported actions.booleanisMessageSupported(ActionMessage<?> message) Test if a specific message is supported by this processor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.ocpp.service.ActionMessageProcessor
processActionMessage
-
Field Details
-
log
protected org.slf4j.Logger logA class-level logger.
-
-
Constructor Details
-
BaseActionMessageProcessor
public BaseActionMessageProcessor(Class<T> messageType, Class<R> resultType, Set<ocpp.domain.Action> supportedActions) Constructor.The
emptyMessagesAllowedproperty will be set to false.- Parameters:
messageType- the message typeresultType- the result typesupportedActions- the supported actions- Throws:
IllegalArgumentException- ifsupportedActionsis null
-
BaseActionMessageProcessor
public BaseActionMessageProcessor(Class<T> messageType, Class<R> resultType, Set<ocpp.domain.Action> supportedActions, boolean emptyMessageAllowed) Constructor.- Parameters:
messageType- the message typeresultType- the result typesupportedActions- the supported actionsemptyMessageAllowed- true if a null message is allowed- Throws:
IllegalArgumentException- ifsupportedActionsis null- Since:
- 1.1
-
-
Method Details
-
getSupportedActions
Description copied from interface:ActionMessageProcessorGet the set of supported actions.- Specified by:
getSupportedActionsin interfaceActionMessageProcessor<T,R> - Returns:
- the set of supported actions; never null
-
isMessageSupported
Test if a specific message is supported by this processor.This implementation returns true if either:
- The
messageTypeis null oremptyMessageAllowedis true and themessage.getMessage()is also null. - The
messageTypeis not null and is assignable frommessage.getMessage().getClass().
- Specified by:
isMessageSupportedin interfaceActionMessageProcessor<T,R> - Parameters:
message- the message- Returns:
- true if
ActionMessageProcessor.processActionMessage(ActionMessage, ActionMessageResultHandler)can handle the given message
- The
-
getMessageType
Get the message type.- Returns:
- the message type
-
getResultType
Get the result type.- Returns:
- the result type
-