public class MessageProcessorValidator extends Object
MessageProcessorValidator class is a helper class that makes sure that a
MessageProcessor is coded properly such that its string-based message type matches the
string-based type of the Java Message class that the processor is typed with.
In addition, the MessageResponse class that the processor is typed with is validated
for existence of proper constructor definitions.
The reason for this validation is to cause the failure to happen at startup of the application instead of discovering during runtime at some point later that a particular message can not be properly processed.
| Constructor and Description |
|---|
MessageProcessorValidator() |
| Modifier and Type | Method and Description |
|---|---|
static void |
validateMessageProcessor(MessageProcessor<? extends Message<? extends MessageResponse>,? extends MessageResponse> processor)
|
public static void validateMessageProcessor(MessageProcessor<? extends Message<? extends MessageResponse>,? extends MessageResponse> processor) throws IllegalStateException
processor is associated with a concrete Message class
that is implemented with the exact same string message type identifier as the processor's type
safe concrete Message implementation.
If incompatibility is found, IllegalStateException is thrown.
Calling this method prevents MessageProcessor/Message pair that are liked by
Java type to produce inconsistent string-based type identifiers.
processor - MessageProcessor to verify for correct Message type
compatibility.IllegalStateException - If processor or its associated Message and
MessageResponse classes are found to be invalid.Copyright © 2018. All rights reserved.