KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > factory > parsing > AliasDefinition


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.beans.factory.parsing;
18
19 import org.springframework.beans.BeanMetadataElement;
20 import org.springframework.util.Assert;
21
22 /**
23  * Representation of an alias that has been registered during the parsing process.
24  *
25  * @author Juergen Hoeller
26  * @since 2.0
27  * @see ReaderEventListener#aliasRegistered(AliasDefinition)
28  */

29 public class AliasDefinition implements BeanMetadataElement {
30
31     private final String JavaDoc beanName;
32
33     private final String JavaDoc alias;
34
35     private final Object JavaDoc source;
36
37
38     /**
39      * Create a new AliasDefinition.
40      * @param beanName the canonical name of the bean
41      * @param alias the alias registered for the bean
42      */

43     public AliasDefinition(String JavaDoc beanName, String JavaDoc alias) {
44         this(beanName, alias, null);
45     }
46
47     /**
48      * Create a new AliasDefinition.
49      * @param beanName the canonical name of the bean
50      * @param alias the alias registered for the bean
51      * @param source the source object (may be <code>null</code>)
52      */

53     public AliasDefinition(String JavaDoc beanName, String JavaDoc alias, Object JavaDoc source) {
54         Assert.notNull(beanName, "Bean name must not be null");
55         Assert.notNull(alias, "Alias must not be null");
56         this.beanName = beanName;
57         this.alias = alias;
58         this.source = source;
59     }
60
61
62     /**
63      * Return the canonical name of the bean.
64      */

65     public String JavaDoc getBeanName() {
66         return beanName;
67     }
68
69     /**
70      * Return the alias registered for the bean.
71      */

72     public String JavaDoc getAlias() {
73         return alias;
74     }
75
76     public Object JavaDoc getSource() {
77         return source;
78     }
79
80 }
81
Popular Tags