polishing

This commit is contained in:
Juergen Hoeller 2010-03-24 10:35:50 +00:00
parent 89755542da
commit 2c2cf32b8a
4 changed files with 30 additions and 25 deletions

View File

@ -16,15 +16,13 @@
package org.springframework.aop.aspectj.annotation;
import static org.junit.Assert.*;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import static org.junit.Assert.*;
import org.junit.Test;
import test.aop.PerThisAspect;
import test.util.SerializationTestUtils;
/**
* @author Rob Harrop
@ -88,8 +86,10 @@ public final class AspectProxyFactoryTests {
proxyFactory.addAspect(aspect);
ITestBean proxy = proxyFactory.getProxy();
assertEquals(target.getAge() * multiple, proxy.getAge());
ITestBean serializedProxy = (ITestBean) SerializationTestUtils.serializeAndDeserialize(proxy);
assertEquals(target.getAge() * multiple, serializedProxy.getAge());
}
@Test(expected=IllegalArgumentException.class)

View File

@ -101,6 +101,11 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
private TypeConverterDelegate typeConverterDelegate;
/**
* The security context used for invoking the property methods
*/
private AccessControlContext acc;
/**
* Cached introspections results for this object, to prevent encountering
* the cost of JavaBeans introspection every time.
@ -112,9 +117,6 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
*/
private Map<String, BeanWrapperImpl> nestedBeanWrappers;
/** The security context used for invoking the property methods */
private AccessControlContext acc;
private boolean autoGrowNestedPaths = false;
@ -216,16 +218,6 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
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() {
return this.object;
}
@ -274,6 +266,22 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
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.
* Needs to be called when the target object changes.

View File

@ -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");
* 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 ServiceLocatorFactoryBean
*/
public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean {
public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean<ObjectFactory> {
private String targetBeanName;
@ -123,7 +123,7 @@ public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean {
}
@Override
protected Object createInstance() {
protected ObjectFactory createInstance() {
return new ObjectFactory() {
public Object getObject() throws BeansException {
return getTargetBean(targetBeanName);

View File

@ -45,7 +45,6 @@ public @interface Scheduled {
* 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
* per minute on weekdays (at the top of the minute - the 0th second).
*
* @return an expression that can be parsed to a cron schedule
*/
String cron() default "";
@ -53,14 +52,12 @@ public @interface Scheduled {
/**
* Execute the annotated method with a fixed period between the end
* of the last invocation and the start of the next.
*
* @return the delay in milliseconds
*/
long fixedDelay() default -1;
/**
* Execute the annotated method with a fixed period between invocations.
*
* @return the period in milliseconds
*/
long fixedRate() default -1;