本文整理汇总了Java中org.springframework.aop.RawTargetAccess类的典型用法代码示例。如果您正苦于以下问题:Java RawTargetAccess类的具体用法?Java RawTargetAccess怎么用?Java RawTargetAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RawTargetAccess类属于org.springframework.aop包,在下文中一共展示了RawTargetAccess类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processReturnType
import org.springframework.aop.RawTargetAccess; //导入依赖的package包/类
/**
* Process a return value. Wraps a return of {@code this} if necessary to be the
* {@code proxy} and also verifies that {@code null} is not returned as a primitive.
*/
private static Object processReturnType(Object proxy, Object target, Method method, Object retVal) {
// Massage return value if necessary
if (retVal != null && retVal == target && !RawTargetAccess.class.isAssignableFrom(method.getDeclaringClass())) {
// Special case: it returned "this". Note that we can't help
// if the target sets a reference to itself in another returned object.
retVal = proxy;
}
Class<?> returnType = method.getReturnType();
if (retVal == null && returnType != Void.TYPE && returnType.isPrimitive()) {
throw new AopInvocationException(
"Null return value from advice does not match primitive return type for: " + method);
}
return retVal;
}