KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > aop > config > PointcutComponentDefinition


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 AbstractComponentDefinition {
31
32     private final String JavaDoc pointcutBeanName;
33
34     private final BeanDefinition pointcutDefinition;
35
36     private final String JavaDoc description;
37
38     private final String JavaDoc expression;
39
40
41     public PointcutComponentDefinition(String JavaDoc pointcutBeanName, BeanDefinition pointcutDefinition, String JavaDoc expression) {
42         Assert.notNull(pointcutBeanName, "Bean name must not be null");
43         Assert.notNull(pointcutDefinition, "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.expression = expression;
48         this.description = "Pointcut <name='" + getName() + "', expression=[" + this.expression + "]>";
49     }
50
51
52     public String JavaDoc getName() {
53         return this.pointcutBeanName;
54     }
55
56     public String JavaDoc getDescription() {
57         return this.description;
58     }
59
60     public BeanDefinition[] getBeanDefinitions() {
61         return new BeanDefinition[] {this.pointcutDefinition};
62     }
63
64     public Object JavaDoc getSource() {
65         return this.pointcutDefinition.getSource();
66     }
67
68 }
69
Popular Tags