Java Code Examples for org.springframework.aop.target.EmptyTargetSource

The following examples show how to use org.springframework.aop.target.EmptyTargetSource. These examples are extracted from open source projects. 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 Project: spring-analysis-note   Source File: AdvisedSupport.java    License: 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 Project: spring-analysis-note   Source File: AopUtilsTests.java    License: 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 Project: java-technology-stack   Source File: AdvisedSupport.java    License: 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 Project: java-technology-stack   Source File: AopUtilsTests.java    License: 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 Project: lams   Source File: AdvisedSupport.java    License: 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 Project: spring4-understanding   Source File: AdvisedSupport.java    License: 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 Project: spring4-understanding   Source File: AopUtilsTests.java    License: 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 Project: spring-analysis-note   Source File: AdvisedSupport.java    License: 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 Project: java-technology-stack   Source File: AdvisedSupport.java    License: 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 Project: lams   Source File: AdvisedSupport.java    License: 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 Project: spring4-understanding   Source File: AdvisedSupport.java    License: 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);
}