Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
xargs perl -p -i -e "s/[ \t]*$//g" {} \;
Issue: SPR-10127
This commit is contained in:
committed by
Chris Beams
parent
44a474a014
commit
1762157ad1
@@ -18,14 +18,14 @@ package org.springframework.aop;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Base interface holding AOP <b>advice</b> (action to take at a joinpoint)
|
||||
* and a filter determining the applicability of the advice (such as
|
||||
* and a filter determining the applicability of the advice (such as
|
||||
* a pointcut). <i>This interface is not for use by Spring users, but to
|
||||
* allow for commonality in support for different types of advice.</i>
|
||||
*
|
||||
* <p>Spring AOP is based around <b>around advice</b> delivered via method
|
||||
* <b>interception</b>, compliant with the AOP Alliance interception API.
|
||||
* <b>interception</b>, compliant with the AOP Alliance interception API.
|
||||
* The Advisor interface allows support for different types of advice,
|
||||
* such as <b>before</b> and <b>after</b> advice, which need not be
|
||||
* implemented using interception.
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.aop;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Subinterface of AOP Alliance Advice that allows additional interfaces
|
||||
* to be implemented by an Advice, and available via a proxy using that
|
||||
* interceptor. This is a fundamental AOP concept called <b>introduction</b>.
|
||||
@@ -37,7 +37,7 @@ import org.aopalliance.aop.Advice;
|
||||
* @see IntroductionAdvisor
|
||||
*/
|
||||
public interface DynamicIntroductionAdvice extends Advice {
|
||||
|
||||
|
||||
/**
|
||||
* Does this introduction advice implement the given interface?
|
||||
* @param intf the interface to check
|
||||
|
||||
@@ -30,7 +30,7 @@ package org.springframework.aop;
|
||||
* @see IntroductionInterceptor
|
||||
*/
|
||||
public interface IntroductionAdvisor extends Advisor, IntroductionInfo {
|
||||
|
||||
|
||||
/**
|
||||
* Return the filter determining which target classes this introduction
|
||||
* should apply to.
|
||||
@@ -39,7 +39,7 @@ public interface IntroductionAdvisor extends Advisor, IntroductionInfo {
|
||||
* @return the class filter
|
||||
*/
|
||||
ClassFilter getClassFilter();
|
||||
|
||||
|
||||
/**
|
||||
* Can the advised interfaces be implemented by the introduction advice?
|
||||
* Invoked before adding an IntroductionAdvisor.
|
||||
|
||||
@@ -29,7 +29,7 @@ package org.springframework.aop;
|
||||
* @since 1.1.1
|
||||
*/
|
||||
public interface IntroductionInfo {
|
||||
|
||||
|
||||
/**
|
||||
* Return the additional interfaces introduced by this Advisor or Advice.
|
||||
* @return the introduced interfaces
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -28,7 +28,7 @@ import java.lang.reflect.Method;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public interface MethodBeforeAdvice extends BeforeAdvice {
|
||||
|
||||
|
||||
/**
|
||||
* Callback before a given method is invoked.
|
||||
* @param method method being invoked
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.io.Serializable;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
class TrueClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
|
||||
public static final TrueClassFilter INSTANCE = new TrueClassFilter();
|
||||
|
||||
|
||||
/**
|
||||
* Enforce Singleton pattern.
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ class TrueClassFilter implements ClassFilter, Serializable {
|
||||
public boolean matches(Class clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Required to support serialization. Replaces with canonical
|
||||
* instance on deserialization, protecting Singleton pattern.
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.lang.reflect.Method;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
class TrueMethodMatcher implements MethodMatcher, Serializable {
|
||||
|
||||
|
||||
public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher();
|
||||
|
||||
|
||||
/**
|
||||
* Enforce Singleton pattern.
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
|
||||
// Should never be invoked as isRuntime returns false.
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Required to support serialization. Replaces with canonical
|
||||
* instance on deserialization, protecting Singleton pattern.
|
||||
@@ -55,7 +55,7 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
|
||||
private Object readResolve() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MethodMatcher.TRUE";
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.io.Serializable;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
class TruePointcut implements Pointcut, Serializable {
|
||||
|
||||
|
||||
public static final TruePointcut INSTANCE = new TruePointcut();
|
||||
|
||||
|
||||
/**
|
||||
* Enforce Singleton pattern.
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ class TruePointcut implements Pointcut, Serializable {
|
||||
public MethodMatcher getMethodMatcher() {
|
||||
return MethodMatcher.TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Required to support serialization. Replaces with canonical
|
||||
* instance on deserialization, protecting Singleton pattern.
|
||||
|
||||
@@ -211,7 +211,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
public void setAspectName(String name) {
|
||||
this.aspectName = name;
|
||||
}
|
||||
|
||||
|
||||
public String getAspectName() {
|
||||
return this.aspectName;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
throw new UnsupportedOperationException("Only afterReturning advice can be used to bind a return value");
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* We need to hold the returning name at this level for argument binding calculations,
|
||||
* this method allows the afterReturning advice subclass to set the name.
|
||||
*/
|
||||
@@ -302,7 +302,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
throw new UnsupportedOperationException("Only afterThrowing advice can be used to bind a thrown exception");
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* We need to hold the throwing name at this level for argument binding calculations,
|
||||
* this method allows the afterThrowing advice subclass to set the name.
|
||||
*/
|
||||
@@ -365,11 +365,11 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
Class[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
|
||||
if (maybeBindJoinPoint(parameterTypes[0]) || maybeBindProceedingJoinPoint(parameterTypes[0])) {
|
||||
numUnboundArgs--;
|
||||
}
|
||||
}
|
||||
else if (maybeBindJoinPointStaticPart(parameterTypes[0])) {
|
||||
numUnboundArgs--;
|
||||
}
|
||||
|
||||
|
||||
if (numUnboundArgs > 0) {
|
||||
// need to bind arguments by name as returned from the pointcut match
|
||||
bindArgumentsByName(numUnboundArgs);
|
||||
@@ -398,7 +398,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean supportsProceedingJoinPoint() {
|
||||
@@ -409,7 +409,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
if (candidateParameterType.equals(JoinPoint.StaticPart.class)) {
|
||||
this.joinPointStaticPartArgumentIndex = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
if (this.argumentNames != null) {
|
||||
// We have been able to determine the arg names.
|
||||
bindExplicitArguments(numArgumentsExpectingToBind);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Advice method [" + this.aspectJAdviceMethod.getName() + "] " +
|
||||
"requires " + numArgumentsExpectingToBind + " arguments to be bound by name, but " +
|
||||
@@ -471,9 +471,9 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
// specified, and find the discovered argument types.
|
||||
if (this.returningName != null) {
|
||||
if (!this.argumentBindings.containsKey(this.returningName)) {
|
||||
throw new IllegalStateException("Returning argument name '"
|
||||
throw new IllegalStateException("Returning argument name '"
|
||||
+ this.returningName + "' was not bound in advice arguments");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Integer index = this.argumentBindings.get(this.returningName);
|
||||
this.discoveredReturningType = this.aspectJAdviceMethod.getParameterTypes()[index];
|
||||
@@ -482,9 +482,9 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
}
|
||||
if (this.throwingName != null) {
|
||||
if (!this.argumentBindings.containsKey(this.throwingName)) {
|
||||
throw new IllegalStateException("Throwing argument name '"
|
||||
throw new IllegalStateException("Throwing argument name '"
|
||||
+ this.throwingName + "' was not bound in advice arguments");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Integer index = this.argumentBindings.get(this.throwingName);
|
||||
this.discoveredThrowingType = this.aspectJAdviceMethod.getParameterTypes()[index];
|
||||
@@ -525,7 +525,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
pointcutParameterTypes[index] = methodParameterTypes[i];
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
this.pointcut.setParameterNames(pointcutParameterNames);
|
||||
this.pointcut.setParameterTypes(pointcutParameterTypes);
|
||||
}
|
||||
@@ -549,7 +549,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
if (this.joinPointArgumentIndex != -1) {
|
||||
adviceInvocationArgs[this.joinPointArgumentIndex] = jp;
|
||||
numBound++;
|
||||
}
|
||||
}
|
||||
else if (this.joinPointStaticPartArgumentIndex != -1) {
|
||||
adviceInvocationArgs[this.joinPointStaticPartArgumentIndex] = jp.getStaticPart();
|
||||
numBound++;
|
||||
@@ -582,8 +582,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
|
||||
if (numBound != this.adviceInvocationArgumentCount) {
|
||||
throw new IllegalStateException("Required to bind " + this.adviceInvocationArgumentCount
|
||||
+ " arguments, but only bound " + numBound + " (JoinPointMatch " +
|
||||
(jpMatch == null ? "was NOT" : "WAS") +
|
||||
+ " arguments, but only bound " + numBound + " (JoinPointMatch " +
|
||||
(jpMatch == null ? "was NOT" : "WAS") +
|
||||
" bound in invocation)");
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class AspectJAfterAdvice extends AbstractAspectJAdvice implements MethodI
|
||||
|
||||
super(aspectJBeforeAdviceMethod, pointcut, aif);
|
||||
}
|
||||
|
||||
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
try {
|
||||
return mi.proceed();
|
||||
|
||||
@@ -259,7 +259,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (BCException ex) {
|
||||
logger.debug("PointcutExpression matching rejected target class", ex);
|
||||
return false;
|
||||
@@ -554,7 +554,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
String advisedBeanName = getCurrentProxiedBeanName();
|
||||
if (advisedBeanName == null) { // no proxy creation in progress
|
||||
// abstain; can't return YES, since that will make pointcut with negation fail
|
||||
return FuzzyBoolean.MAYBE;
|
||||
return FuzzyBoolean.MAYBE;
|
||||
}
|
||||
if (BeanFactoryUtils.isGeneratedBeanName(advisedBeanName)) {
|
||||
return FuzzyBoolean.NO;
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.aop.support.AbstractGenericPointcutAdvisor;
|
||||
|
||||
/**
|
||||
* Spring AOP Advisor that can be used for any AspectJ pointcut expression.
|
||||
*
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AspectJProxyUtils {
|
||||
|
||||
|
||||
/**
|
||||
* Add special advisors if necessary to work with a proxy chain that contains AspectJ advisors.
|
||||
* This will expose the current Spring AOP invocation (necessary for some AspectJ pointcut matching)
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.aspectj.bridge.IMessageHandler;
|
||||
* Implementation of AspectJ's {@link IMessageHandler} interface that
|
||||
* routes AspectJ weaving messages through the same logging system as the
|
||||
* regular Spring messages.
|
||||
*
|
||||
*
|
||||
* <p>Pass the option...
|
||||
*
|
||||
* <p><code class="code">-XmessageHandlerClass:org.springframework.aop.aspectj.AspectJWeaverMessageHandler</code>
|
||||
@@ -44,9 +44,9 @@ import org.aspectj.bridge.IMessageHandler;
|
||||
public class AspectJWeaverMessageHandler implements IMessageHandler {
|
||||
|
||||
private static final String AJ_ID = "[AspectJ] ";
|
||||
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog("AspectJ Weaver");
|
||||
|
||||
|
||||
|
||||
public boolean handleMessage(IMessage message) throws AbortException {
|
||||
Kind messageKind = message.getKind();
|
||||
@@ -56,39 +56,39 @@ public class AspectJWeaverMessageHandler implements IMessageHandler {
|
||||
LOGGER.debug(makeMessageFor(message));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (LOGGER.isInfoEnabled()) {
|
||||
if ((messageKind == IMessage.INFO) || (messageKind == IMessage.WEAVEINFO)) {
|
||||
LOGGER.info(makeMessageFor(message));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (LOGGER.isWarnEnabled()) {
|
||||
if (messageKind == IMessage.WARNING) {
|
||||
LOGGER.warn(makeMessageFor(message));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (LOGGER.isErrorEnabled()) {
|
||||
if (messageKind == IMessage.ERROR) {
|
||||
LOGGER.error(makeMessageFor(message));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (LOGGER.isFatalEnabled()) {
|
||||
if (messageKind == IMessage.ABORT) {
|
||||
LOGGER.fatal(makeMessageFor(message));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private String makeMessageFor(IMessage aMessage) {
|
||||
return AJ_ID + aMessage.getMessage();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
||||
* @param defaultImpl the default implementation class
|
||||
*/
|
||||
public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defaultImpl) {
|
||||
this(interfaceType, typePattern, defaultImpl,
|
||||
this(interfaceType, typePattern, defaultImpl,
|
||||
new DelegatePerTargetObjectIntroductionInterceptor(defaultImpl, interfaceType));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
||||
* @param delegateRef the delegate implementation object
|
||||
*/
|
||||
public DeclareParentsAdvisor(Class interfaceType, String typePattern, Object delegateRef) {
|
||||
this(interfaceType, typePattern, delegateRef.getClass(),
|
||||
this(interfaceType, typePattern, delegateRef.getClass(),
|
||||
new DelegatingIntroductionInterceptor(delegateRef));
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.Assert;
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, JoinPoint.StaticPart {
|
||||
|
||||
|
||||
private final ProxyMethodInvocation methodInvocation;
|
||||
|
||||
private Object[] defensiveCopyOfArgs;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* This class encapsulates some AspectJ internal knowledge that should be
|
||||
* pushed back into the AspectJ project in a future release.
|
||||
* pushed back into the AspectJ project in a future release.
|
||||
*
|
||||
* <p>It relies on implementation specific knowledge in AspectJ to break
|
||||
* encapsulation and do something AspectJ was not designed to do: query
|
||||
@@ -137,7 +137,7 @@ class RuntimeTestWalker {
|
||||
|
||||
public void visit(MatchingContextBasedTest matchingContextTest) {
|
||||
}
|
||||
|
||||
|
||||
protected int getVarType(ReflectionVar v) {
|
||||
try {
|
||||
Field varTypeField = ReflectionVar.class.getDeclaredField("varType");
|
||||
@@ -169,7 +169,7 @@ class RuntimeTestWalker {
|
||||
this.matches = defaultMatches;
|
||||
this.matchVarType = matchVarType;
|
||||
}
|
||||
|
||||
|
||||
public boolean instanceOfMatches(Test test) {
|
||||
test.accept(this);
|
||||
return matches;
|
||||
@@ -236,7 +236,7 @@ class RuntimeTestWalker {
|
||||
aTest.accept(this);
|
||||
return this.testsSubtypeSensitiveVars;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(Instanceof i) {
|
||||
ReflectionVar v = (ReflectionVar) i.getVar();
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
|
||||
* @see SimpleAspectInstanceFactory
|
||||
*/
|
||||
public class SingletonAspectInstanceFactory implements AspectInstanceFactory {
|
||||
|
||||
|
||||
private final Object aspectInstance;
|
||||
|
||||
|
||||
|
||||
@@ -47,11 +47,11 @@ public class TypePatternClassFilter implements ClassFilter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fully configured {@link TypePatternClassFilter} using the
|
||||
* Create a fully configured {@link TypePatternClassFilter} using the
|
||||
* given type pattern.
|
||||
* @param typePattern the type pattern that AspectJ weaver should parse
|
||||
* @throws IllegalArgumentException if the supplied <code>typePattern</code> is <code>null</code>
|
||||
* or is recognized as invalid
|
||||
* or is recognized as invalid
|
||||
*/
|
||||
public TypePatternClassFilter(String typePattern) {
|
||||
setTypePattern(typePattern);
|
||||
@@ -73,7 +73,7 @@ public class TypePatternClassFilter implements ClassFilter {
|
||||
* <p>These conventions are established by AspectJ, not Spring AOP.
|
||||
* @param typePattern the type pattern that AspectJ weaver should parse
|
||||
* @throws IllegalArgumentException if the supplied <code>typePattern</code> is <code>null</code>
|
||||
* or is recognized as invalid
|
||||
* or is recognized as invalid
|
||||
*/
|
||||
public void setTypePattern(String typePattern) {
|
||||
Assert.notNull(typePattern);
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.springframework.util.StringUtils;
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFactory {
|
||||
|
||||
|
||||
protected static final ParameterNameDiscoverer ASPECTJ_ANNOTATION_PARAMETER_NAME_DISCOVERER =
|
||||
new AspectJAnnotationParameterNameDiscoverer();
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||
|
||||
/**
|
||||
* We need to detect this as "code-style" AspectJ aspects should not be
|
||||
* interpreted by Spring AOP.
|
||||
* interpreted by Spring AOP.
|
||||
*/
|
||||
private boolean compiledByAjc(Class<?> clazz) {
|
||||
// The AJTypeSystem goes to great lengths to provide a uniform appearance between code-style and
|
||||
@@ -154,11 +154,11 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||
if (ajType.getPerClause().getKind() == PerClauseKind.PERCFLOWBELOW) {
|
||||
throw new AopConfigException(aspectClass.getName() + " uses percflowbelow instantiation model: " +
|
||||
"This is not supported in Spring AOP.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The pointcut and advice annotations both have an "argNames" member which contains a
|
||||
* The pointcut and advice annotations both have an "argNames" member which contains a
|
||||
* comma-separated list of the argument names. We use this (if non-empty) to build the
|
||||
* formal parameters for the pointcut.
|
||||
*/
|
||||
@@ -169,13 +169,13 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||
if (pointcutParameterNames != null) {
|
||||
pointcutParameterTypes = extractPointcutParameterTypes(pointcutParameterNames,annotatedMethod);
|
||||
}
|
||||
|
||||
|
||||
AspectJExpressionPointcut ajexp =
|
||||
new AspectJExpressionPointcut(declarationScope,pointcutParameterNames,pointcutParameterTypes);
|
||||
ajexp.setLocation(annotatedMethod.toString());
|
||||
return ajexp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the pointcut parameters needed by aspectj based on the given argument names
|
||||
* and the argument types that are available from the adviceMethod. Needs to take into
|
||||
@@ -326,10 +326,10 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||
return names;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String[] getParameterNames(Constructor ctor) {
|
||||
throw new UnsupportedOperationException("Spring AOP cannot handle constructor advice");
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ public class AspectMetadata {
|
||||
private final Pointcut perClausePointcut;
|
||||
|
||||
/**
|
||||
* The name of this aspect as defined to Spring (the bean name) -
|
||||
* allows us to determine if two pieces of advice come from the
|
||||
* The name of this aspect as defined to Spring (the bean name) -
|
||||
* allows us to determine if two pieces of advice come from the
|
||||
* same aspect and hence their relative precedence.
|
||||
*/
|
||||
private String aspectName;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.ClassUtils;
|
||||
* backed by a Spring {@link org.springframework.beans.factory.BeanFactory}.
|
||||
*
|
||||
* <p>Note that this may instantiate multiple times if using a prototype,
|
||||
* which probably won't give the semantics you expect.
|
||||
* which probably won't give the semantics you expect.
|
||||
* Use a {@link LazySingletonAspectInstanceFactoryDecorator}
|
||||
* to wrap this to ensure only one new aspect comes back.
|
||||
*
|
||||
@@ -56,7 +56,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst
|
||||
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) {
|
||||
this(beanFactory, name, beanFactory.getType(name));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should
|
||||
* introspect to create AJType metadata. Use if the BeanFactory may consider the type
|
||||
|
||||
@@ -41,23 +41,23 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
||||
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation {
|
||||
|
||||
private final AspectJExpressionPointcut declaredPointcut;
|
||||
|
||||
|
||||
private Pointcut pointcut;
|
||||
|
||||
|
||||
private final MetadataAwareAspectInstanceFactory aspectInstanceFactory;
|
||||
|
||||
|
||||
private final Method method;
|
||||
|
||||
|
||||
private final boolean lazy;
|
||||
|
||||
|
||||
private final AspectJAdvisorFactory atAspectJAdvisorFactory;
|
||||
|
||||
|
||||
private Advice instantiatedAdvice;
|
||||
|
||||
private int declarationOrder;
|
||||
|
||||
|
||||
private String aspectName;
|
||||
|
||||
|
||||
private Boolean isBeforeAdvice;
|
||||
|
||||
private Boolean isAfterAdvice;
|
||||
@@ -72,12 +72,12 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
||||
this.aspectInstanceFactory = aif;
|
||||
this.declarationOrder = declarationOrderInAspect;
|
||||
this.aspectName = aspectName;
|
||||
|
||||
|
||||
if (aif.getAspectMetadata().isLazilyInstantiated()) {
|
||||
// Static part of the pointcut is a lazy type.
|
||||
Pointcut preInstantiationPointcut =
|
||||
Pointcuts.union(aif.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut);
|
||||
|
||||
|
||||
// Make it dynamic: must mutate from pre-instantiation to post-instantiation state.
|
||||
// If it's not a dynamic pointcut, it may be optimized out
|
||||
// by the Spring AOP infrastructure after the first evaluation.
|
||||
@@ -109,7 +109,7 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
||||
public boolean isPerInstance() {
|
||||
return (getAspectMetadata().getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the AspectJ AspectMetadata for this advisor.
|
||||
*/
|
||||
@@ -126,7 +126,7 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
||||
}
|
||||
return this.instantiatedAdvice;
|
||||
}
|
||||
|
||||
|
||||
public boolean isLazy() {
|
||||
return this.lazy;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
||||
return this.atAspectJAdvisorFactory.getAdvice(
|
||||
this.method, pcut, this.aspectInstanceFactory, this.declarationOrder, this.aspectName);
|
||||
}
|
||||
|
||||
|
||||
public MetadataAwareAspectInstanceFactory getAspectInstanceFactory() {
|
||||
return this.aspectInstanceFactory;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we get here, we know we have an AspectJ method.
|
||||
// If we get here, we know we have an AspectJ method.
|
||||
// Check that it's an AspectJ-annotated class
|
||||
if (!isAspect(candidateAspectClass)) {
|
||||
throw new AopConfigException("Advice must be declared inside an aspect type: " +
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
*
|
||||
* Classes enabling AspectJ 5 @Annotated classes to be used in Spring AOP.
|
||||
*
|
||||
*
|
||||
* <p>Normally to be used through an AspectJAutoProxyCreator rather than directly.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -72,8 +72,8 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
||||
for (Advisor element : advisors) {
|
||||
partiallyComparableAdvisors.add(
|
||||
new PartiallyComparableAdvisorHolder(element, DEFAULT_PRECEDENCE_COMPARATOR));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// sort it
|
||||
List<PartiallyComparableAdvisorHolder> sorted =
|
||||
(List<PartiallyComparableAdvisorHolder>) PartialOrder.sort(partiallyComparableAdvisors);
|
||||
@@ -81,13 +81,13 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
||||
// TODO: work harder to give a better error message here.
|
||||
throw new IllegalArgumentException("Advice precedence circularity error");
|
||||
}
|
||||
|
||||
|
||||
// extract results again
|
||||
List<Advisor> result = new LinkedList<Advisor>();
|
||||
for (PartiallyComparableAdvisorHolder pcAdvisor : sorted) {
|
||||
result.add(pcAdvisor.getAdvisor());
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,14 +106,14 @@ class AspectJPrecedenceComparator implements Comparator {
|
||||
boolean oneOrOtherIsAfterAdvice =
|
||||
(AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
|
||||
int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2);
|
||||
|
||||
|
||||
if (oneOrOtherIsAfterAdvice) {
|
||||
// the advice declared last has higher precedence
|
||||
if (adviceDeclarationOrderDelta < 0) {
|
||||
// advice1 was declared before advice2
|
||||
// so advice1 has lower precedence
|
||||
return LOWER_PRECEDENCE;
|
||||
}
|
||||
}
|
||||
else if (adviceDeclarationOrderDelta == 0) {
|
||||
return SAME_PRECEDENCE;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class AspectJPrecedenceComparator implements Comparator {
|
||||
}
|
||||
|
||||
private int getAspectDeclarationOrder(Advisor anAdvisor) {
|
||||
AspectJPrecedenceInformation precedenceInfo =
|
||||
AspectJPrecedenceInformation precedenceInfo =
|
||||
AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
|
||||
if (precedenceInfo != null) {
|
||||
return precedenceInfo.getDeclarationOrder();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* annotation-style methods, and an AspectJExpressionPointcut: a Spring AOP Pointcut
|
||||
* implementation that allows use of the AspectJ pointcut expression language with the Spring AOP
|
||||
* runtime framework.
|
||||
*
|
||||
*
|
||||
* <p>Note that use of this package does <i>not</i> require the use of the <code>ajc</code> compiler
|
||||
* or AspectJ load-time weaver. It is intended to enable the use of a valuable subset of AspectJ
|
||||
* functionality, with consistent semantics, with the proxy-based Spring AOP framework.
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
|
||||
|
||||
public final BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definitionHolder, ParserContext parserContext) {
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
|
||||
|
||||
// get the root bean name - will be the name of the generated proxy factory bean
|
||||
String existingBeanName = definitionHolder.getBeanName();
|
||||
BeanDefinition targetDefinition = definitionHolder.getBeanDefinition();
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.beans.factory.parsing.ParseState;
|
||||
|
||||
/**
|
||||
* {@link ParseState} entry representing an advice element.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.beans.factory.parsing.ParseState;
|
||||
|
||||
/**
|
||||
* {@link ParseState} entry representing an advisor.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,8 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Utility class for handling registration of AOP auto-proxy creators.
|
||||
*
|
||||
* <p>Only a single auto-proxy creator can be registered yet multiple concrete
|
||||
* implementations are available. Therefore this class wraps a simple escalation
|
||||
* <p>Only a single auto-proxy creator can be registered yet multiple concrete
|
||||
* implementations are available. Therefore this class wraps a simple escalation
|
||||
* protocol, allowing classes to request a particular auto-proxy creator and know
|
||||
* that class, <code>or a subclass thereof</code>, will eventually be resident
|
||||
* in the application context.
|
||||
|
||||
@@ -93,7 +93,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
||||
private static final int ASPECT_INSTANCE_FACTORY_INDEX = 2;
|
||||
|
||||
private ParseState parseState = new ParseState();
|
||||
|
||||
|
||||
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
CompositeComponentDefinition compositeDef =
|
||||
@@ -281,10 +281,10 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(DeclareParentsAdvisor.class);
|
||||
builder.addConstructorArgValue(declareParentsElement.getAttribute(IMPLEMENT_INTERFACE));
|
||||
builder.addConstructorArgValue(declareParentsElement.getAttribute(TYPE_PATTERN));
|
||||
|
||||
|
||||
String defaultImpl = declareParentsElement.getAttribute(DEFAULT_IMPL);
|
||||
String delegateRef = declareParentsElement.getAttribute(DELEGATE_REF);
|
||||
|
||||
|
||||
if (StringUtils.hasText(defaultImpl) && !StringUtils.hasText(delegateRef)) {
|
||||
builder.addConstructorArgValue(defaultImpl);
|
||||
}
|
||||
@@ -435,7 +435,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
||||
String expression = pointcutElement.getAttribute(EXPRESSION);
|
||||
|
||||
AbstractBeanDefinition pointcutDefinition = null;
|
||||
|
||||
|
||||
try {
|
||||
this.parseState.push(new PointcutEntry(id));
|
||||
pointcutDefinition = createPointcutDefinition(expression);
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.beans.factory.parsing.ParseState;
|
||||
|
||||
/**
|
||||
* {@link ParseState} entry representing a pointcut.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -47,7 +47,7 @@ class ScopedProxyBeanDefinitionDecorator implements BeanDefinitionDecorator {
|
||||
proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Register the original bean definition as it will be referenced by the scoped proxy
|
||||
// and is relevant for tooling (validation, navigation).
|
||||
BeanDefinitionHolder holder =
|
||||
|
||||
@@ -124,7 +124,7 @@ public interface Advised extends TargetClassAware {
|
||||
*/
|
||||
void addAdvisor(Advisor advisor) throws AopConfigException;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add an Advisor at the specified position in the chain.
|
||||
* @param advisor the advisor to add at the specified position in the chain
|
||||
* @param pos position in chain (0 is head). Must be valid.
|
||||
|
||||
@@ -35,7 +35,7 @@ package org.springframework.aop.framework;
|
||||
*
|
||||
* <p>Proxies may or may not allow advice changes to be made.
|
||||
* If they do not permit advice changes (for example, because
|
||||
* the configuration was frozen) a proxy should throw an
|
||||
* the configuration was frozen) a proxy should throw an
|
||||
* {@link AopConfigException} on an attempted advice change.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private String[] interceptorNames;
|
||||
|
||||
|
||||
private String targetName;
|
||||
|
||||
private boolean autodetectInterfaces = true;
|
||||
@@ -543,10 +543,10 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
||||
Advisor advisor = namedBeanToAdvisor(next);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Adding advisor with name '" + name + "'");
|
||||
}
|
||||
}
|
||||
addAdvisor(advisor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a TargetSource to use when creating a proxy. If the target was not
|
||||
* specified at the end of the interceptorNames list, the TargetSource will be
|
||||
@@ -627,24 +627,24 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
||||
private final String beanName;
|
||||
|
||||
private final String message;
|
||||
|
||||
|
||||
public PrototypePlaceholderAdvisor(String beanName) {
|
||||
this.beanName = beanName;
|
||||
this.message = "Placeholder for prototype Advisor/Advice with bean name '" + beanName + "'";
|
||||
}
|
||||
|
||||
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
|
||||
public Advice getAdvice() {
|
||||
throw new UnsupportedOperationException("Cannot invoke methods: " + this.message);
|
||||
}
|
||||
|
||||
|
||||
public boolean isPerInstance() {
|
||||
throw new UnsupportedOperationException("Cannot invoke methods: " + this.message);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.message;
|
||||
|
||||
@@ -87,13 +87,13 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.exceptionHandlerMap.isEmpty()) {
|
||||
throw new IllegalArgumentException(
|
||||
"At least one handler method must be found in class [" + throwsAdvice.getClass() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getHandlerMethodCount() {
|
||||
return this.exceptionHandlerMap.size();
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void invokeHandlerMethod(MethodInvocation mi, Throwable ex, Method method) throws Throwable {
|
||||
Object[] handlerArgs;
|
||||
if (method.getParameterTypes().length == 1) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* its capabilities, don't need to concern themselves with this package.
|
||||
* <br>
|
||||
* You may wish to use these adapters to wrap Spring-specific advices, such as MethodBeforeAdvice,
|
||||
* in MethodInterceptor, to allow their use in another AOP framework supporting the AOP Alliance interfaces.
|
||||
* in MethodInterceptor, to allow their use in another AOP framework supporting the AOP Alliance interfaces.
|
||||
* </br>
|
||||
* <br>
|
||||
* These adapters do not depend on any other Spring framework classes to allow such usage.
|
||||
|
||||
@@ -94,6 +94,6 @@ public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCrea
|
||||
@Override
|
||||
protected boolean isEligibleAdvisorBean(String beanName) {
|
||||
return (!isUsePrefix() || beanName.startsWith(getAdvisorBeanNamePrefix()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.aop.TargetSource;
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public interface TargetSourceCreator {
|
||||
|
||||
|
||||
/**
|
||||
* Create a special TargetSource for the given bean, if any.
|
||||
* @param beanClass the class of the bean to create a TargetSource for
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
*
|
||||
* Bean post-processors for use in ApplicationContexts to simplify AOP usage
|
||||
* by automatically creating AOP proxies without the need to use a ProxyFactoryBean.
|
||||
*
|
||||
*
|
||||
* <p>The various post-processors in this package need only be added to an ApplicationContext
|
||||
* (typically in an XML bean definition document) to automatically proxy selected beans.
|
||||
*
|
||||
*
|
||||
* <p><b>NB</b>: Automatic auto-proxying is not supported for BeanFactory implementations,
|
||||
* as post-processors beans are only automatically detected in application contexts.
|
||||
* Post-processors can be explicitly registered on a ConfigurableBeanFactory instead.
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.aop.target.ThreadLocalTargetSource;
|
||||
|
||||
/**
|
||||
* Convenient TargetSourceCreator using bean name prefixes to create one of three
|
||||
* well-known TargetSource types:
|
||||
* well-known TargetSource types:
|
||||
* <li>: CommonsPoolTargetSource
|
||||
* <li>% ThreadLocalTargetSource
|
||||
* <li>! PrototypeTargetSource
|
||||
@@ -59,5 +59,5 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
*
|
||||
* Package containing Spring's basic AOP infrastructure, compliant with the
|
||||
* <a href="http://aopalliance.sourceforge.net">AOP Alliance</a> interfaces.
|
||||
*
|
||||
*
|
||||
* <p>Spring AOP supports proxying interfaces or classes, introductions, and offers
|
||||
* static and dynamic pointcuts.
|
||||
*
|
||||
*
|
||||
* <p>Any Spring AOP proxy can be cast to the ProxyConfig AOP configuration interface
|
||||
* in this package to add or remove interceptors.
|
||||
*
|
||||
*
|
||||
* <p>The ProxyFactoryBean is a convenient way to create AOP proxies in a BeanFactory
|
||||
* or ApplicationContext. However, proxies can be created programmatically using the
|
||||
* ProxyFactory class.
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
* <p>Subclasses should call the <code>createInvocationTraceName(MethodInvocation)</code>
|
||||
* method to create a name for the given trace that includes information about the
|
||||
* method invocation under trace along with the prefix and suffix added as appropriate.
|
||||
*
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2.7
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -125,7 +125,7 @@ public abstract class ExposeBeanNameAdvisors {
|
||||
*/
|
||||
private static class ExposeBeanNameIntroduction extends DelegatingIntroductionInterceptor implements NamedBean {
|
||||
|
||||
private final String beanName;
|
||||
private final String beanName;
|
||||
|
||||
public ExposeBeanNameIntroduction(String beanName) {
|
||||
this.beanName = beanName;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.apache.commons.logging.Log;
|
||||
* and output the stats.
|
||||
*
|
||||
* <p>This code is inspired by Thierry Templier's blog.
|
||||
*
|
||||
*
|
||||
* @author Dmitriy Kopylenko
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
*
|
||||
* Core Spring AOP interfaces, built on AOP Alliance AOP interoperability interfaces.
|
||||
*
|
||||
*
|
||||
* <br>Any AOP Alliance MethodInterceptor is usable in Spring.
|
||||
*
|
||||
*
|
||||
* <br>Spring AOP also offers:
|
||||
* <ul>
|
||||
* <li>Introduction support
|
||||
@@ -15,7 +15,7 @@
|
||||
* <li>Extensibility allowing arbitrary custom advice types to
|
||||
* be plugged in without modifying the core framework.
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* <br>
|
||||
* Spring AOP can be used programmatically or (preferably)
|
||||
* integrated with the Spring IoC container.
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Default implementation of the {@link ScopedObject} interface.
|
||||
*
|
||||
*
|
||||
* <p>Simply delegates the calls to the underlying
|
||||
* {@link ConfigurableBeanFactory bean factory}
|
||||
* ({@link ConfigurableBeanFactory#getBean(String)}/
|
||||
|
||||
@@ -49,5 +49,5 @@ public interface ScopedObject extends RawTargetAccess {
|
||||
* the exact same target object in the target scope).
|
||||
*/
|
||||
void removeFromScope();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Convenient proxy factory bean for scoped objects.
|
||||
*
|
||||
*
|
||||
* <p>Proxies created using this factory bean are thread-safe singletons
|
||||
* and may be injected into shared objects, with transparent scoping behavior.
|
||||
*
|
||||
* <p>Proxies returned by this class implement the {@link ScopedObject} interface.
|
||||
* This presently allows for removing the corresponding object from the scope,
|
||||
* seamlessly creating a new instance in the scope on next access.
|
||||
*
|
||||
*
|
||||
* <p>Please note that the proxies created by this factory are
|
||||
* <i>class-based</i> proxies by default. This can be customized
|
||||
* through switching the "proxyTargetClass" property to "false".
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class ScopedProxyUtils {
|
||||
*/
|
||||
public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder definition,
|
||||
BeanDefinitionRegistry registry, boolean proxyTargetClass) {
|
||||
|
||||
|
||||
String originalBeanName = definition.getBeanName();
|
||||
BeanDefinition targetDefinition = definition.getBeanDefinition();
|
||||
|
||||
@@ -87,7 +87,7 @@ public abstract class ScopedProxyUtils {
|
||||
// (potentially an inner bean).
|
||||
return new BeanDefinitionHolder(proxyDefinition, originalBeanName, definition.getAliases());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the bean name that is used within the scoped proxy to reference the target bean.
|
||||
* @param originalBeanName the original name of bean
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFilter, Ordered, Serializable {
|
||||
|
||||
private final Advice advice;
|
||||
|
||||
|
||||
private final Set<Class> interfaces = new HashSet<Class>();
|
||||
|
||||
private int order = Integer.MAX_VALUE;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple
|
||||
*/
|
||||
public DefaultPointcutAdvisor() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a DefaultPointcutAdvisor that matches all methods.
|
||||
* <p><code>Pointcut.TRUE</code> will be used as Pointcut.
|
||||
@@ -55,7 +55,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple
|
||||
public DefaultPointcutAdvisor(Advice advice) {
|
||||
this(Pointcut.TRUE, advice);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a DefaultPointcutAdvisor, specifying Pointcut and Advice.
|
||||
* @param pointcut the Pointcut targeting the Advice
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.springframework.aop.ProxyMethodInvocation;
|
||||
public class DelegatePerTargetObjectIntroductionInterceptor extends IntroductionInfoSupport
|
||||
implements IntroductionInterceptor {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Hold weak references to keys as we don't want to interfere with garbage collection..
|
||||
*/
|
||||
private final Map<Object, Object> delegateMap = new WeakHashMap<Object, Object>();
|
||||
@@ -85,12 +85,12 @@ public class DelegatePerTargetObjectIntroductionInterceptor extends Introduction
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
if (isMethodOnIntroducedInterface(mi)) {
|
||||
Object delegate = getIntroductionDelegateFor(mi.getThis());
|
||||
|
||||
|
||||
// Using the following method rather than direct reflection,
|
||||
// we get correct handling of InvocationTargetException
|
||||
// if the introduced method throws an exception.
|
||||
Object retVal = AopUtils.invokeJoinpointUsingReflection(delegate, mi.getMethod(), mi.getArguments());
|
||||
|
||||
|
||||
// Massage return value if possible: if the delegate returned itself,
|
||||
// we really want to return the proxy.
|
||||
if (retVal == delegate && mi instanceof ProxyMethodInvocation) {
|
||||
@@ -126,7 +126,7 @@ public class DelegatePerTargetObjectIntroductionInterceptor extends Introduction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Object createNewDelegate() {
|
||||
try {
|
||||
return this.defaultImplType.newInstance();
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.Assert;
|
||||
* <p>The <code>suppressInterface</code> method can be used to suppress interfaces
|
||||
* implemented by the delegate but which should not be introduced to the owning
|
||||
* AOP proxy.
|
||||
*
|
||||
*
|
||||
* <p>An instance of this class is serializable if the delegate is.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
|
||||
implements IntroductionInterceptor {
|
||||
|
||||
|
||||
/**
|
||||
* Object that actually implements the interfaces.
|
||||
* May be "this" if a subclass implements the introduced interfaces.
|
||||
@@ -66,7 +66,7 @@ public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
|
||||
public DelegatingIntroductionInterceptor(Object delegate) {
|
||||
init(delegate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new DelegatingIntroductionInterceptor.
|
||||
* The delegate will be the subclass, which must implement
|
||||
@@ -91,8 +91,8 @@ public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
|
||||
suppressInterface(IntroductionInterceptor.class);
|
||||
suppressInterface(DynamicIntroductionAdvice.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Subclasses may need to override this if they want to perform custom
|
||||
* behaviour in around advice. However, subclasses should invoke this
|
||||
@@ -104,7 +104,7 @@ public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
|
||||
// get correct handling of InvocationTargetException
|
||||
// if the introduced method throws an exception.
|
||||
Object retVal = AopUtils.invokeJoinpointUsingReflection(this.delegate, mi.getMethod(), mi.getArguments());
|
||||
|
||||
|
||||
// Massage return value if possible: if the delegate returned itself,
|
||||
// we really want to return the proxy.
|
||||
if (retVal == this.delegate && mi instanceof ProxyMethodInvocation) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -38,13 +38,13 @@ import java.util.regex.PatternSyntaxException;
|
||||
* @since 1.1
|
||||
*/
|
||||
public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Compiled form of the patterns.
|
||||
*/
|
||||
private Pattern[] compiledPatterns = new Pattern[0];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Compiled form of the exclusion patterns.
|
||||
*/
|
||||
private Pattern[] compiledExclusionPatterns = new Pattern[0];
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -25,11 +25,11 @@ import org.springframework.aop.ClassFilter;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class RootClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
|
||||
private Class clazz;
|
||||
|
||||
|
||||
// TODO inheritance
|
||||
|
||||
|
||||
public RootClassFilter(Class clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -22,7 +22,7 @@ import org.springframework.aop.MethodMatcher;
|
||||
|
||||
/**
|
||||
* Convenient abstract superclass for static method matchers, which don't care
|
||||
* about arguments at runtime.
|
||||
* about arguments at runtime.
|
||||
*/
|
||||
public abstract class StaticMethodMatcher implements MethodMatcher {
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBased
|
||||
* @throws Exception to avoid placing constraints on pooling APIs
|
||||
*/
|
||||
protected abstract void createPool() throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Acquire an object from the pool.
|
||||
* @return an object from the pool
|
||||
@@ -98,7 +98,7 @@ public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBased
|
||||
* APIs, so we're forgiving with our exception signature
|
||||
*/
|
||||
public abstract Object getTarget() throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Return the given object to the pool.
|
||||
* @param target object that must have been acquired from the pool
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.core.Constants;
|
||||
* properties are explictly not mirrored because the implementation of
|
||||
* <code>PoolableObjectFactory</code> used by this class does not implement
|
||||
* meaningful validation. All exposed Commons Pool properties use the corresponding
|
||||
* Commons Pool defaults: for example,
|
||||
* Commons Pool defaults: for example,
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
@@ -58,11 +58,11 @@ public class SingletonTargetSource implements TargetSource, Serializable {
|
||||
public Class<?> getTargetClass() {
|
||||
return this.target.getClass();
|
||||
}
|
||||
|
||||
|
||||
public Object getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
|
||||
public void releaseTarget(Object target) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.springframework.core.NamedThreadLocal;
|
||||
*/
|
||||
public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
|
||||
implements ThreadLocalTargetSourceStats, DisposableBean {
|
||||
|
||||
|
||||
/**
|
||||
* ThreadLocal holding the target associated with the current
|
||||
* thread. Unlike most ThreadLocals, which are static, this variable
|
||||
@@ -62,9 +62,9 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
|
||||
* Set of managed targets, enabling us to keep track of the targets we've created.
|
||||
*/
|
||||
private final Set<Object> targetSet = new HashSet<Object>();
|
||||
|
||||
|
||||
private int invocationCount;
|
||||
|
||||
|
||||
private int hitCount;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dispose of targets if necessary; clear ThreadLocal.
|
||||
* @see #destroyPrototypeInstance
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -23,7 +23,7 @@ package org.springframework.aop.target;
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public interface ThreadLocalTargetSourceStats {
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of client invocations.
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Reference in New Issue
Block a user