Class BeanValidationInterceptor<T extends Message<?>>
java.lang.Object
org.axonframework.messaging.interceptors.legacyvalidation.BeanValidationInterceptor<T>
- All Implemented Interfaces:
MessageDispatchInterceptor<T>,MessageHandlerInterceptor<T>
@Deprecated
public class BeanValidationInterceptor<T extends Message<?>>
extends Object
implements MessageHandlerInterceptor<T>, MessageDispatchInterceptor<T>
Deprecated.
Interceptor that applies JSR303 bean validation on incoming
Messages. When validation on a message fails, a
JSR303ViolationException is thrown, holding the constraint violations. This interceptor can either be used as
a MessageHandlerInterceptor or as a MessageDispatchInterceptor.- Since:
- 1.1
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Initializes a validation interceptor using a defaultValidatorFactory.BeanValidationInterceptor(javax.validation.ValidatorFactory validatorFactory) Deprecated.Initializes a validation interceptor using the givenValidatorFactory. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Apply this interceptor to the given list ofmessages.handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) Deprecated.Invoked before a Message is handled by a designatedMessageHandler.validateMessage(Object message, javax.validation.Validator validator) Deprecated.Validate the givenmessageusing the givenvalidator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.MessageDispatchInterceptor
handle
-
Constructor Details
-
BeanValidationInterceptor
public BeanValidationInterceptor()Deprecated.Initializes a validation interceptor using a defaultValidatorFactory.- See Also:
-
BeanValidationInterceptor
public BeanValidationInterceptor(javax.validation.ValidatorFactory validatorFactory) Deprecated.Initializes a validation interceptor using the givenValidatorFactory.- Parameters:
validatorFactory- the factory providingValidatorinstances for this interceptor
-
-
Method Details
-
handle
public Object handle(@Nonnull UnitOfWork<? extends T> unitOfWork, @Nonnull InterceptorChain interceptorChain) throws Exception Deprecated.Description copied from interface:MessageHandlerInterceptorInvoked before a Message is handled by a designatedMessageHandler. The interceptor is responsible for the continuation of the handling process by invoking theInterceptorChain.proceed()method on the giveninterceptorChain. The givenunitOfWorkcontains contextual information. Any information gathered by interceptors may be attached to the unitOfWork. Interceptors are highly recommended not to change the type of the message handling result, as the dispatching component might expect a result of a specific type.- Specified by:
handlein interfaceMessageHandlerInterceptor<T extends Message<?>>- Parameters:
unitOfWork- The UnitOfWork that is processing the messageinterceptorChain- The interceptor chain that allows this interceptor to proceed the dispatch process- Returns:
- the result of the message handler. May have been modified by interceptors.
- Throws:
Exception- any exception that occurs while handling the message
-
handle
Deprecated.Description copied from interface:MessageDispatchInterceptorApply this interceptor to the given list ofmessages. This method returns a function that can be invoked to obtain a modified version of messages at each position in the list.- Specified by:
handlein interfaceMessageDispatchInterceptor<T extends Message<?>>- Parameters:
messages- The Messages to pre-process- Returns:
- a function that processes messages based on their position in the list
-
validateMessage
protected Set<javax.validation.ConstraintViolation<Object>> validateMessage(Object message, javax.validation.Validator validator) Deprecated.Validate the givenmessageusing the givenvalidator. The default implementation merely callsvalidator.validate(message).Subclasses may override this method to alter the validation behavior in specific cases. Although the
nullis accepted as return value to indicate that there are no constraint violations, implementations are encouraged to return an empty Set instead.- Parameters:
message- the message to validatevalidator- the validator provided by the validator factory- Returns:
- a set of
ConstraintViolations. May also returnnull
-
BeanValidationInterceptorwhich moved to jakarta.