polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3155 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
e62e56a1a4
commit
639f4581e8
|
|
@ -16,15 +16,13 @@
|
||||||
|
|
||||||
package org.springframework.aop.aspectj.annotation;
|
package org.springframework.aop.aspectj.annotation;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import test.aop.PerThisAspect;
|
import test.aop.PerThisAspect;
|
||||||
|
import test.util.SerializationTestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
|
|
@ -88,8 +86,10 @@ public final class AspectProxyFactoryTests {
|
||||||
proxyFactory.addAspect(aspect);
|
proxyFactory.addAspect(aspect);
|
||||||
|
|
||||||
ITestBean proxy = proxyFactory.getProxy();
|
ITestBean proxy = proxyFactory.getProxy();
|
||||||
|
|
||||||
assertEquals(target.getAge() * multiple, proxy.getAge());
|
assertEquals(target.getAge() * multiple, proxy.getAge());
|
||||||
|
|
||||||
|
ITestBean serializedProxy = (ITestBean) SerializationTestUtils.serializeAndDeserialize(proxy);
|
||||||
|
assertEquals(target.getAge() * multiple, serializedProxy.getAge());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,11 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
|
|
||||||
private TypeConverterDelegate typeConverterDelegate;
|
private TypeConverterDelegate typeConverterDelegate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The security context used for invoking the property methods
|
||||||
|
*/
|
||||||
|
private AccessControlContext acc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached introspections results for this object, to prevent encountering
|
* Cached introspections results for this object, to prevent encountering
|
||||||
* the cost of JavaBeans introspection every time.
|
* the cost of JavaBeans introspection every time.
|
||||||
|
|
@ -112,9 +117,6 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
*/
|
*/
|
||||||
private Map<String, BeanWrapperImpl> nestedBeanWrappers;
|
private Map<String, BeanWrapperImpl> nestedBeanWrappers;
|
||||||
|
|
||||||
/** The security context used for invoking the property methods */
|
|
||||||
private AccessControlContext acc;
|
|
||||||
|
|
||||||
private boolean autoGrowNestedPaths = false;
|
private boolean autoGrowNestedPaths = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -216,16 +218,6 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
setIntrospectionClass(object.getClass());
|
setIntrospectionClass(object.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the security context used during the invocation of the wrapped instance methods.
|
|
||||||
* Can be null.
|
|
||||||
*
|
|
||||||
* @param acc
|
|
||||||
*/
|
|
||||||
public void setSecurityContext(AccessControlContext acc) {
|
|
||||||
this.acc = acc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Object getWrappedInstance() {
|
public final Object getWrappedInstance() {
|
||||||
return this.object;
|
return this.object;
|
||||||
}
|
}
|
||||||
|
|
@ -274,6 +266,22 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
return this.autoGrowNestedPaths;
|
return this.autoGrowNestedPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the security context used during the invocation of the wrapped instance methods.
|
||||||
|
* Can be null.
|
||||||
|
*/
|
||||||
|
public void setSecurityContext(AccessControlContext acc) {
|
||||||
|
this.acc = acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the security context used during the invocation of the wrapped instance methods.
|
||||||
|
* Can be null.
|
||||||
|
*/
|
||||||
|
public AccessControlContext getSecurityContext() {
|
||||||
|
return this.acc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the class to introspect.
|
* Set the class to introspect.
|
||||||
* Needs to be called when the target object changes.
|
* Needs to be called when the target object changes.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2007 the original author or authors.
|
* Copyright 2002-2010 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.
|
||||||
|
|
@ -91,7 +91,7 @@ import org.springframework.util.Assert;
|
||||||
* @see org.springframework.beans.factory.ObjectFactory
|
* @see org.springframework.beans.factory.ObjectFactory
|
||||||
* @see ServiceLocatorFactoryBean
|
* @see ServiceLocatorFactoryBean
|
||||||
*/
|
*/
|
||||||
public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean {
|
public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean<ObjectFactory> {
|
||||||
|
|
||||||
private String targetBeanName;
|
private String targetBeanName;
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object createInstance() {
|
protected ObjectFactory createInstance() {
|
||||||
return new ObjectFactory() {
|
return new ObjectFactory() {
|
||||||
public Object getObject() throws BeansException {
|
public Object getObject() throws BeansException {
|
||||||
return getTargetBean(targetBeanName);
|
return getTargetBean(targetBeanName);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import java.lang.annotation.Target;
|
||||||
* Annotation that marks a method to be scheduled. Exactly one of the
|
* Annotation that marks a method to be scheduled. Exactly one of the
|
||||||
* <code>cron</code>, <code>fixedDelay</code>, or <code>fixedRate</code>
|
* <code>cron</code>, <code>fixedDelay</code>, or <code>fixedRate</code>
|
||||||
* attributes must be provided.
|
* attributes must be provided.
|
||||||
*
|
*
|
||||||
* <p>The annotated method must expect no arguments and have a
|
* <p>The annotated method must expect no arguments and have a
|
||||||
* <code>void</code> return type.
|
* <code>void</code> return type.
|
||||||
*
|
*
|
||||||
|
|
@ -45,7 +45,6 @@ public @interface Scheduled {
|
||||||
* triggers on the second as well as minute, hour, day of month, month
|
* triggers on the second as well as minute, hour, day of month, month
|
||||||
* and day of week. e.g. <code>"0 * * * * MON-FRI"</code> means once
|
* and day of week. e.g. <code>"0 * * * * MON-FRI"</code> means once
|
||||||
* per minute on weekdays (at the top of the minute - the 0th second).
|
* per minute on weekdays (at the top of the minute - the 0th second).
|
||||||
*
|
|
||||||
* @return an expression that can be parsed to a cron schedule
|
* @return an expression that can be parsed to a cron schedule
|
||||||
*/
|
*/
|
||||||
String cron() default "";
|
String cron() default "";
|
||||||
|
|
@ -53,14 +52,12 @@ public @interface Scheduled {
|
||||||
/**
|
/**
|
||||||
* Execute the annotated method with a fixed period between the end
|
* Execute the annotated method with a fixed period between the end
|
||||||
* of the last invocation and the start of the next.
|
* of the last invocation and the start of the next.
|
||||||
*
|
|
||||||
* @return the delay in milliseconds
|
* @return the delay in milliseconds
|
||||||
*/
|
*/
|
||||||
long fixedDelay() default -1;
|
long fixedDelay() default -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the annotated method with a fixed period between invocations.
|
* Execute the annotated method with a fixed period between invocations.
|
||||||
*
|
|
||||||
* @return the period in milliseconds
|
* @return the period in milliseconds
|
||||||
*/
|
*/
|
||||||
long fixedRate() default -1;
|
long fixedRate() default -1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue