com.elasticpath.service.interceptor
Class ValidateInterceptor

java.lang.Object
  extended by com.elasticpath.service.interceptor.ValidateInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class ValidateInterceptor
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor

ValidateInterceptor intercepts service calls and validate the domain objects passed in.


Constructor Summary
ValidateInterceptor()
           
 
Method Summary
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
          Validate the arguments to service calls if it is a domain object.
 void setDefaultBeanValidator(org.springmodules.commons.validator.DefaultBeanValidator defaultBeanValidator)
          Set the validator.
 void validate(EpDomain epDomain)
          Validate the domain object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidateInterceptor

public ValidateInterceptor()
Method Detail

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
                        throws java.lang.Throwable
Validate the arguments to service calls if it is a domain object.

Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Parameters:
methodInvocation - the method invocation to be intercepted and validated
Returns:
the return value of the intercepted method
Throws:
java.lang.Throwable - on error

setDefaultBeanValidator

public void setDefaultBeanValidator(org.springmodules.commons.validator.DefaultBeanValidator defaultBeanValidator)
Set the validator.

Parameters:
defaultBeanValidator - the validator

validate

public void validate(EpDomain epDomain)
              throws EpDomainException
Validate the domain object.

Parameters:
epDomain - the domain object to be validated
Throws:
EpDomainException - if there is a problem
java.lang.IllegalArgumentException - thrown if the validator doesn't support the specified class