Browse Source

Polishing

Issue: SPR-11344
(cherry picked from commit d434ef9)
pull/451/head
Juergen Hoeller 11 years ago
parent
commit
3310ab55e0
  1. 8
      spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java
  2. 13
      spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java
  3. 9
      spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java
  4. 10
      spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java

8
spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,9 +19,9 @@ package org.springframework.aop; @@ -19,9 +19,9 @@ package org.springframework.aop;
import java.lang.reflect.Method;
/**
* A specialized type of MethodMatcher that takes into account introductions when
* matching methods. If there are no introductions on the target class, a method
* matcher may be able to optimize matching more effectively for example.
* A specialized type of {@link MethodMatcher} that takes into account introductions
* when matching methods. If there are no introductions on the target class,
* a method matcher may be able to optimize matching more effectively for example.
*
* @author Adrian Colyer
* @since 2.0

13
spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,8 +23,7 @@ import org.springframework.util.Assert; @@ -23,8 +23,7 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Static utility methods for composing
* {@link org.springframework.aop.ClassFilter ClassFilters}.
* Static utility methods for composing {@link ClassFilter ClassFilters}.
*
* @author Rod Johnson
* @author Rob Harrop
@ -98,8 +97,8 @@ public abstract class ClassFilters { @@ -98,8 +97,8 @@ public abstract class ClassFilters {
@Override
public boolean matches(Class<?> clazz) {
for (int i = 0; i < this.filters.length; i++) {
if (this.filters[i].matches(clazz)) {
for (ClassFilter filter : this.filters) {
if (filter.matches(clazz)) {
return true;
}
}
@ -133,8 +132,8 @@ public abstract class ClassFilters { @@ -133,8 +132,8 @@ public abstract class ClassFilters {
@Override
public boolean matches(Class<?> clazz) {
for (int i = 0; i < this.filters.length; i++) {
if (!this.filters[i].matches(clazz)) {
for (ClassFilter filter : this.filters) {
if (!filter.matches(clazz)) {
return false;
}
}

9
spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java

@ -25,12 +25,11 @@ import org.springframework.aop.MethodMatcher; @@ -25,12 +25,11 @@ import org.springframework.aop.MethodMatcher;
import org.springframework.util.Assert;
/**
* Static utility methods for composing
* {@link org.springframework.aop.MethodMatcher MethodMatchers}.
* Static utility methods for composing {@link MethodMatcher MethodMatchers}.
*
* <p>A MethodMatcher may be evaluated statically (based on method
* and target class) or need further evaluation dynamically
* (based on arguments at the time of method invocation).
* <p>A MethodMatcher may be evaluated statically (based on method and target
* class) or need further evaluation dynamically (based on arguments at the
* time of method invocation).
*
* @author Rod Johnson
* @author Rob Harrop

10
spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,16 +34,21 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -34,16 +34,21 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
public final class TargetPointcutSelectionTests {
public TestInterface testImpl1;
public TestInterface testImpl2;
public TestAspect testAspectForTestImpl1;
public TestAspect testAspectForAbstractTestImpl;
public TestInterceptor testInterceptor;
@Before
public void setUp() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testImpl1 = (TestInterface) ctx.getBean("testImpl1");
testImpl2 = (TestInterface) ctx.getBean("testImpl2");
testAspectForTestImpl1 = (TestAspect) ctx.getBean("testAspectForTestImpl1");
@ -55,6 +60,7 @@ public final class TargetPointcutSelectionTests { @@ -55,6 +60,7 @@ public final class TargetPointcutSelectionTests {
testInterceptor.count = 0;
}
@Test
public void testTargetSelectionForMatchedType() {
testImpl1.interfaceMethod();

Loading…
Cancel
Save