36
36
37
37
/**
38
38
* Utility methods for AOP proxy factories.
39
- * Mainly for internal use within the AOP framework.
39
+ *
40
+ * <p>Mainly for internal use within the AOP framework.
40
41
*
41
42
* <p>See {@link org.springframework.aop.support.AopUtils} for a collection of
42
43
* generic AOP utility methods which do not depend on AOP framework internals.
@@ -59,10 +60,10 @@ public abstract class AopProxyUtils {
59
60
*/
60
61
@ Nullable
61
62
public static Object getSingletonTarget (Object candidate ) {
62
- if (candidate instanceof Advised ) {
63
- TargetSource targetSource = (( Advised ) candidate ) .getTargetSource ();
64
- if (targetSource instanceof SingletonTargetSource ) {
65
- return (( SingletonTargetSource ) targetSource ) .getTarget ();
63
+ if (candidate instanceof Advised advised ) {
64
+ TargetSource targetSource = advised .getTargetSource ();
65
+ if (targetSource instanceof SingletonTargetSource singleTargetSource ) {
66
+ return singleTargetSource .getTarget ();
66
67
}
67
68
}
68
69
return null ;
@@ -82,8 +83,8 @@ public static Class<?> ultimateTargetClass(Object candidate) {
82
83
Assert .notNull (candidate , "Candidate object must not be null" );
83
84
Object current = candidate ;
84
85
Class <?> result = null ;
85
- while (current instanceof TargetClassAware ) {
86
- result = (( TargetClassAware ) current ) .getTargetClass ();
86
+ while (current instanceof TargetClassAware targetClassAware ) {
87
+ result = targetClassAware .getTargetClass ();
87
88
current = getSingletonTarget (current );
88
89
}
89
90
if (result == null ) {
0 commit comments