org.springmodules.validation.bean.context.aop
Class AbstractValidationContextInterceptor

java.lang.Object
  extended by org.springmodules.validation.bean.context.aop.AbstractValidationContextInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
Direct Known Subclasses:
SimpleValidationContextInterceptor

public abstract class AbstractValidationContextInterceptor
extends Object
implements org.aopalliance.intercept.MethodInterceptor

A parent class to any around validation context advice that intercepts method invocations.

This advice is based on DefaultValidationContext and relies on the getValidationContextTokens(org.aopalliance.intercept.MethodInvocation) implementation to supply the appropiate context.

Author:
Uri Boness

Constructor Summary
AbstractValidationContextInterceptor()
           
 
Method Summary
protected abstract  String[] getValidationContextTokens(org.aopalliance.intercept.MethodInvocation methodInvocation)
          Will be implemented by all subclasses to determine what validation context tokens will be supported by the validation context associated with the given method invocation.
 Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
           
 void setExtendExistingContext(boolean extendExistingContext)
          Determines whether this interceptor should extend the already exsiting context (if one already exists).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractValidationContextInterceptor

public AbstractValidationContextInterceptor()
Method Detail

invoke

public Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
              throws Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
Throwable

getValidationContextTokens

protected abstract String[] getValidationContextTokens(org.aopalliance.intercept.MethodInvocation methodInvocation)
Will be implemented by all subclasses to determine what validation context tokens will be supported by the validation context associated with the given method invocation.

Parameters:
methodInvocation - The given method invocation.
Returns:
The tokens supported by the validation context associated with the given method invocation.

setExtendExistingContext

public void setExtendExistingContext(boolean extendExistingContext)
Determines whether this interceptor should extend the already exsiting context (if one already exists). If so, the tokens returned by getValidationContextTokens(org.aopalliance.intercept.MethodInvocation) will be supported along with all tokens supported by the already existing validation context.

By default this advice does not extend the already existing context, instead it creates and sets a new one.

Parameters:
extendExistingContext - Determines whether this interceptor should extend the already exsiting context (if one already exists).


Copyright © 2009. All Rights Reserved.