Fix Checkstyle violation and rearrange getAdvisorCount declaration

See gh-26017
This commit is contained in:
Juergen Hoeller
2020-11-04 16:43:31 +01:00
parent fbf8e37f94
commit a4679b87b9
2 changed files with 14 additions and 13 deletions

View File

@@ -114,6 +114,15 @@ public interface Advised extends TargetClassAware {
*/
Advisor[] getAdvisors();
/**
* Return the number of advisors applying to this proxy.
* <p>The default implementation delegates to {@code getAdvisors().length}.
* @since 5.3.1
*/
default int getAdvisorCount() {
return getAdvisors().length;
}
/**
* Add an advisor at the end of the advisor chain.
* <p>The Advisor may be an {@link org.springframework.aop.IntroductionAdvisor},
@@ -223,12 +232,4 @@ public interface Advised extends TargetClassAware {
*/
String toProxyConfigString();
/**
* Equivalent to {@code getAdvisors().length}
* @return count of advisors of this advised
*/
default int getAdvisorCount() {
return getAdvisors().length;
}
}

View File

@@ -241,6 +241,11 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
return this.advisors.toArray(new Advisor[0]);
}
@Override
public int getAdvisorCount() {
return this.advisors.size();
}
@Override
public void addAdvisor(Advisor advisor) {
int pos = this.advisors.size();
@@ -534,11 +539,6 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
this.methodCache = new ConcurrentHashMap<>(32);
}
@Override
public int getAdvisorCount() {
return advisors.size();
}
@Override
public String toProxyConfigString() {
return toString();