org.springframework.aop.target.EmptyTargetSource Java Examples

The following examples show how to use org.springframework.aop.target.EmptyTargetSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdvisedSupport.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Build a configuration-only copy of this AdvisedSupport,
 * replacing the TargetSource.
 */
AdvisedSupport getConfigurationOnlyCopy() {
	AdvisedSupport copy = new AdvisedSupport();
	copy.copyFrom(this);
	copy.targetSource = EmptyTargetSource.forClass(getTargetClass(), getTargetSource().isStatic());
	copy.advisorChainFactory = this.advisorChainFactory;
	copy.interfaces = this.interfaces;
	copy.advisors = this.advisors;
	copy.updateAdvisorArray();
	return copy;
}
 
Example #2
Source File: AopUtilsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Test that when we serialize and deserialize various canonical instances
 * of AOP classes, they return the same instance, not a new instance
 * that's subverted the singleton construction limitation.
 */
@Test
public void testCanonicalFrameworkClassesStillCanonicalOnDeserialization() throws Exception {
	assertSame(MethodMatcher.TRUE, SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE));
	assertSame(ClassFilter.TRUE, SerializationTestUtils.serializeAndDeserialize(ClassFilter.TRUE));
	assertSame(Pointcut.TRUE, SerializationTestUtils.serializeAndDeserialize(Pointcut.TRUE));
	assertSame(EmptyTargetSource.INSTANCE, SerializationTestUtils.serializeAndDeserialize(EmptyTargetSource.INSTANCE));
	assertSame(Pointcuts.SETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.SETTERS));
	assertSame(Pointcuts.GETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.GETTERS));
	assertSame(ExposeInvocationInterceptor.INSTANCE,
			SerializationTestUtils.serializeAndDeserialize(ExposeInvocationInterceptor.INSTANCE));
}
 
Example #3
Source File: AdvisedSupport.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Build a configuration-only copy of this AdvisedSupport,
 * replacing the TargetSource.
 */
AdvisedSupport getConfigurationOnlyCopy() {
	AdvisedSupport copy = new AdvisedSupport();
	copy.copyFrom(this);
	copy.targetSource = EmptyTargetSource.forClass(getTargetClass(), getTargetSource().isStatic());
	copy.advisorChainFactory = this.advisorChainFactory;
	copy.interfaces = this.interfaces;
	copy.advisors = this.advisors;
	copy.updateAdvisorArray();
	return copy;
}
 
Example #4
Source File: AopUtilsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Test that when we serialize and deserialize various canonical instances
 * of AOP classes, they return the same instance, not a new instance
 * that's subverted the singleton construction limitation.
 */
@Test
public void testCanonicalFrameworkClassesStillCanonicalOnDeserialization() throws Exception {
	assertSame(MethodMatcher.TRUE, SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE));
	assertSame(ClassFilter.TRUE, SerializationTestUtils.serializeAndDeserialize(ClassFilter.TRUE));
	assertSame(Pointcut.TRUE, SerializationTestUtils.serializeAndDeserialize(Pointcut.TRUE));
	assertSame(EmptyTargetSource.INSTANCE, SerializationTestUtils.serializeAndDeserialize(EmptyTargetSource.INSTANCE));
	assertSame(Pointcuts.SETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.SETTERS));
	assertSame(Pointcuts.GETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.GETTERS));
	assertSame(ExposeInvocationInterceptor.INSTANCE,
			SerializationTestUtils.serializeAndDeserialize(ExposeInvocationInterceptor.INSTANCE));
}
 
Example #5
Source File: AdvisedSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build a configuration-only copy of this AdvisedSupport,
 * replacing the TargetSource
 */
AdvisedSupport getConfigurationOnlyCopy() {
	AdvisedSupport copy = new AdvisedSupport();
	copy.copyFrom(this);
	copy.targetSource = EmptyTargetSource.forClass(getTargetClass(), getTargetSource().isStatic());
	copy.advisorChainFactory = this.advisorChainFactory;
	copy.interfaces = this.interfaces;
	copy.advisors = this.advisors;
	copy.updateAdvisorArray();
	return copy;
}
 
Example #6
Source File: AdvisedSupport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Build a configuration-only copy of this AdvisedSupport,
 * replacing the TargetSource
 */
AdvisedSupport getConfigurationOnlyCopy() {
	AdvisedSupport copy = new AdvisedSupport();
	copy.copyFrom(this);
	copy.targetSource = EmptyTargetSource.forClass(getTargetClass(), getTargetSource().isStatic());
	copy.advisorChainFactory = this.advisorChainFactory;
	copy.interfaces = this.interfaces;
	copy.advisors = this.advisors;
	copy.updateAdvisorArray();
	return copy;
}
 
Example #7
Source File: AopUtilsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Test that when we serialize and deserialize various canonical instances
 * of AOP classes, they return the same instance, not a new instance
 * that's subverted the singleton construction limitation.
 */
@Test
public void testCanonicalFrameworkClassesStillCanonicalOnDeserialization() throws Exception {
	assertSame(MethodMatcher.TRUE, SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE));
	assertSame(ClassFilter.TRUE, SerializationTestUtils.serializeAndDeserialize(ClassFilter.TRUE));
	assertSame(Pointcut.TRUE, SerializationTestUtils.serializeAndDeserialize(Pointcut.TRUE));
	assertSame(EmptyTargetSource.INSTANCE, SerializationTestUtils.serializeAndDeserialize(EmptyTargetSource.INSTANCE));
	assertSame(Pointcuts.SETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.SETTERS));
	assertSame(Pointcuts.GETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.GETTERS));
	assertSame(ExposeInvocationInterceptor.INSTANCE,
			SerializationTestUtils.serializeAndDeserialize(ExposeInvocationInterceptor.INSTANCE));
}
 
Example #8
Source File: AdvisedSupport.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Set a target class to be proxied, indicating that the proxy
 * should be castable to the given class.
 * <p>Internally, an {@link org.springframework.aop.target.EmptyTargetSource}
 * for the given target class will be used. The kind of proxy needed
 * will be determined on actual creation of the proxy.
 * <p>This is a replacement for setting a "targetSource" or "target",
 * for the case where we want a proxy based on a target class
 * (which can be an interface or a concrete class) without having
 * a fully capable TargetSource available.
 * @see #setTargetSource
 * @see #setTarget
 */
public void setTargetClass(@Nullable Class<?> targetClass) {
	this.targetSource = EmptyTargetSource.forClass(targetClass);
}
 
Example #9
Source File: AdvisedSupport.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Set a target class to be proxied, indicating that the proxy
 * should be castable to the given class.
 * <p>Internally, an {@link org.springframework.aop.target.EmptyTargetSource}
 * for the given target class will be used. The kind of proxy needed
 * will be determined on actual creation of the proxy.
 * <p>This is a replacement for setting a "targetSource" or "target",
 * for the case where we want a proxy based on a target class
 * (which can be an interface or a concrete class) without having
 * a fully capable TargetSource available.
 * @see #setTargetSource
 * @see #setTarget
 */
public void setTargetClass(@Nullable Class<?> targetClass) {
	this.targetSource = EmptyTargetSource.forClass(targetClass);
}
 
Example #10
Source File: AdvisedSupport.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set a target class to be proxied, indicating that the proxy
 * should be castable to the given class.
 * <p>Internally, an {@link org.springframework.aop.target.EmptyTargetSource}
 * for the given target class will be used. The kind of proxy needed
 * will be determined on actual creation of the proxy.
 * <p>This is a replacement for setting a "targetSource" or "target",
 * for the case where we want a proxy based on a target class
 * (which can be an interface or a concrete class) without having
 * a fully capable TargetSource available.
 * @see #setTargetSource
 * @see #setTarget
 */
public void setTargetClass(Class<?> targetClass) {
	this.targetSource = EmptyTargetSource.forClass(targetClass);
}
 
Example #11
Source File: AdvisedSupport.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set a target class to be proxied, indicating that the proxy
 * should be castable to the given class.
 * <p>Internally, an {@link org.springframework.aop.target.EmptyTargetSource}
 * for the given target class will be used. The kind of proxy needed
 * will be determined on actual creation of the proxy.
 * <p>This is a replacement for setting a "targetSource" or "target",
 * for the case where we want a proxy based on a target class
 * (which can be an interface or a concrete class) without having
 * a fully capable TargetSource available.
 * @see #setTargetSource
 * @see #setTarget
 */
public void setTargetClass(Class<?> targetClass) {
	this.targetSource = EmptyTargetSource.forClass(targetClass);
}