@ -1,5 +1,5 @@
/ *
/ *
* Copyright 2002 - 2007 the original author or authors .
* Copyright 2002 - 2009 the original author or authors .
*
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* you may not use this file except in compliance with the License .
@ -27,6 +27,7 @@ import org.aspectj.lang.reflect.SourceLocation;
import org.aspectj.runtime.internal.AroundClosure ;
import org.aspectj.runtime.internal.AroundClosure ;
import org.springframework.aop.ProxyMethodInvocation ;
import org.springframework.aop.ProxyMethodInvocation ;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer ;
import org.springframework.util.Assert ;
import org.springframework.util.Assert ;
/ * *
/ * *
@ -151,7 +152,9 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
/ * *
/ * *
* Lazily initialized MethodSignature .
* Lazily initialized MethodSignature .
* /
* /
private class MethodSignatureImpl implements Signature , MethodSignature {
private class MethodSignatureImpl implements MethodSignature {
private volatile String [ ] parameterNames ;
public String getName ( ) {
public String getName ( ) {
return methodInvocation . getMethod ( ) . getName ( ) ;
return methodInvocation . getMethod ( ) . getName ( ) ;
@ -182,10 +185,10 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
}
}
public String [ ] getParameterNames ( ) {
public String [ ] getParameterNames ( ) {
// TODO consider allowing use of ParameterNameDiscoverer, or tying into
if ( this . parameterNames = = null ) {
// parameter names exposed for argument binding...
this . parameterNames = ( new LocalVariableTableParameterNameDiscoverer ( ) ) . getParameterNames ( getMethod ( ) ) ;
throw new UnsupportedOperationException (
}
"Parameter names cannot be determined unless compiled by AspectJ compiler" ) ;
return this . parameterNames ;
}
}
public Class [ ] getExceptionTypes ( ) {
public Class [ ] getExceptionTypes ( ) {
@ -204,63 +207,56 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
return toString ( false , true , false , true ) ;
return toString ( false , true , false , true ) ;
}
}
private String toString ( boolean includeModifier ,
private String toString ( boolean includeModifier , boolean includeReturnTypeAndArgs ,
boolean includeReturnTypeAndArgs ,
boolean useLongReturnAndArgumentTypeName , boolean useLongTypeName ) {
boolean useLongReturnAndArgumentTypeName ,
boolean useLongTypeName ) {
StringBuilder sb = new StringBuilder ( ) ;
StringBuilder sb = new StringBuilder ( ) ;
if ( includeModifier ) {
if ( includeModifier ) {
sb . append ( Modifier . toString ( getModifiers ( ) ) ) ;
sb . append ( Modifier . toString ( getModifiers ( ) ) ) ;
sb . append ( " " ) ;
sb . append ( " " ) ;
}
}
if ( includeReturnTypeAndArgs ) {
if ( includeReturnTypeAndArgs ) {
appendType ( sb , getReturnType ( ) ,
appendType ( sb , getReturnType ( ) , useLongReturnAndArgumentTypeName ) ;
useLongReturnAndArgumentTypeName ) ;
sb . append ( " " ) ;
sb . append ( " " ) ;
}
}
appendType ( sb , getDeclaringType ( ) , useLongTypeName ) ;
appendType ( sb , getDeclaringType ( ) , useLongTypeName ) ;
sb . append ( "." ) ;
sb . append ( "." ) ;
sb . append ( getMethod ( ) . getName ( ) ) ;
sb . append ( getMethod ( ) . getName ( ) ) ;
sb . append ( "(" ) ;
sb . append ( "(" ) ;
Class [ ] parametersTypes = getParameterTypes ( ) ;
Class [ ] parametersTypes = getParameterTypes ( ) ;
appendTypes ( sb , parametersTypes , includeReturnTypeAndArgs ,
appendTypes ( sb , parametersTypes , includeReturnTypeAndArgs , useLongReturnAndArgumentTypeName ) ;
useLongReturnAndArgumentTypeName ) ;
sb . append ( ")" ) ;
sb . append ( ")" ) ;
return sb . toString ( ) ;
return sb . toString ( ) ;
}
}
}
private void appendTypes ( StringBuilder sb , Class < ? > [ ] types ,
private void appendTypes ( StringBuilder sb , Class < ? > [ ] types ,
boolean includeArgs , boolean useLongReturnAndArgumentTypeName ) {
boolean includeArgs , boolean useLongReturnAndArgumentTypeName ) {
if ( includeArgs ) {
if ( includeArgs ) {
for ( int size = types . length , i = 0 ; i < size ; i + + ) {
for ( int size = types . length , i = 0 ; i < size ; i + + ) {
appendType ( sb , types [ i ] , useLongReturnAndArgumentTypeName ) ;
appendType ( sb , types [ i ] , useLongReturnAndArgumentTypeName ) ;
if ( i < size - 1 ) {
if ( i < size - 1 ) {
sb . append ( "," ) ;
sb . append ( "," ) ;
}
}
}
}
}
} else {
else {
if ( types . length ! = 0 ) {
if ( types . length ! = 0 ) {
sb . append ( ".." ) ;
sb . append ( ".." ) ;
}
}
}
}
}
}
private void appendType ( StringBuilder sb , Class < ? > type ,
private void appendType ( StringBuilder sb , Class < ? > type , boolean useLongTypeName ) {
boolean useLongTypeName ) {
if ( type . isArray ( ) ) {
if ( type . isArray ( ) ) {
appendType ( sb , type . getComponentType ( ) , useLongTypeName ) ;
appendType ( sb , type . getComponentType ( ) , useLongTypeName ) ;
sb . append ( "[]" ) ;
sb . append ( "[]" ) ;
}
} else {
else {
if ( type . getPackage ( ) ! = null
sb . append ( useLongTypeName ? type . getName ( ) : type . getSimpleName ( ) ) ;
& & type . getPackage ( ) . equals ( "java.lang" ) ) {
useLongTypeName = false ;
}
}
sb . append ( useLongTypeName ? type . getName ( ) : type . getSimpleName ( ) ) ;
}
}
}
}
/ * *
/ * *
* Lazily initialized SourceLocation .
* Lazily initialized SourceLocation .
* /
* /