org.equilibriums.aop.utils.interceptor.convert
Class ConvertMethodReturnValueInterceptor
java.lang.Object
org.equilibriums.aop.utils.interceptor.convert.ConvertMethodReturnValueInterceptor
- All Implemented Interfaces:
- org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
public class ConvertMethodReturnValueInterceptor
- extends Object
- implements org.aopalliance.intercept.MethodInterceptor
Will take return value from Joinpoint.proceed() get the property specified by getFromPropertyPath(),
convert it using specified Converter and replace property specified by
getToPropertyPath().
The paths are defines according to org.apache.commons.lang.StringUtils#getProperty or org.apache.commons.lang.StringUtils#setProperty documentation.
For example given method "public String method1();
To convert return String value null as getFromPropertyPath()
and null as getToPropertyPath().
For example given method "public Map method1();
To convert value defined by key "key1" use [key1] as getFromPropertyPath()
and [key1] as getToPropertyPath().
For more on how to use this interceptor see Overview section of this Javadoc.
- Author:
- Tsolak Petrosian
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConvertMethodReturnValueInterceptor
public ConvertMethodReturnValueInterceptor()
getConverter
public Converter getConverter()
setConverter
public void setConverter(Converter converter)
getFromPropertyPath
public String getFromPropertyPath()
setFromPropertyPath
public void setFromPropertyPath(String fromPropertyPath)
getToPropertyPath
public String getToPropertyPath()
setToPropertyPath
public void setToPropertyPath(String toPropertyPath)
invoke
public final Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
throws Throwable
- Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
- Throws:
Throwable
Copyright © 2011. All Rights Reserved.