01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.aop.config;
18:
19: import org.springframework.beans.factory.config.BeanDefinition;
20: import org.springframework.beans.factory.parsing.AbstractComponentDefinition;
21: import org.springframework.util.Assert;
22:
23: /**
24: * {@link org.springframework.beans.factory.parsing.ComponentDefinition}
25: * implementation that holds a pointcut definition.
26: *
27: * @author Rob Harrop
28: * @since 2.0
29: */
30: public class PointcutComponentDefinition extends
31: AbstractComponentDefinition {
32:
33: private final String pointcutBeanName;
34:
35: private final BeanDefinition pointcutDefinition;
36:
37: private final String description;
38:
39: public PointcutComponentDefinition(String pointcutBeanName,
40: BeanDefinition pointcutDefinition, String expression) {
41: Assert.notNull(pointcutBeanName, "Bean name must not be null");
42: Assert.notNull(pointcutDefinition,
43: "Pointcut definition must not be null");
44: Assert.notNull(expression, "Expression must not be null");
45: this .pointcutBeanName = pointcutBeanName;
46: this .pointcutDefinition = pointcutDefinition;
47: this .description = "Pointcut <name='" + pointcutBeanName
48: + "', expression=[" + expression + "]>";
49: }
50:
51: public String getName() {
52: return this .pointcutBeanName;
53: }
54:
55: public String getDescription() {
56: return this .description;
57: }
58:
59: public BeanDefinition[] getBeanDefinitions() {
60: return new BeanDefinition[] { this .pointcutDefinition };
61: }
62:
63: public Object getSource() {
64: return this.pointcutDefinition.getSource();
65: }
66:
67: }
|