KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > factory > annotation > Autowire


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.annotation;
18
19 import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
20
21 /**
22  * Enumeration determining autowiring status: that is, whether a bean should
23  * have its dependencies automatically injected by the Spring container using
24  * setter injection. This is a core concept in Spring DI.
25  *
26  * <p>Available for use in annotation-based configurations, such as for the AspectJ
27  * AnnotationBeanConfigurer aspect.
28  *
29  * @author Rod Johnson
30  * @author Juergen Hoeller
31  * @since 2.0
32  * @see org.springframework.beans.factory.annotation.Configurable
33  * @see org.springframework.beans.factory.config.AutowireCapableBeanFactory
34  */

35 public enum Autowire {
36     
37     /**
38      * Constant that indicates that autowiring information was not specified.
39      * In some cases it may be necessary to specify autowiring status,
40      * but merely confirm that this should be inherited from an enclosing
41      * container definition scope.
42      */

43     INHERITED(-1),
44     
45     /**
46      * Constant that indicates no autowiring at all.
47      */

48     NO(AutowireCapableBeanFactory.AUTOWIRE_NO),
49
50     /**
51      * Constant that indicates autowiring bean properties by name.
52      */

53     BY_NAME(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME),
54
55     /**
56      * Constant that indicates autowiring bean properties by type.
57      */

58     BY_TYPE(AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE);
59
60
61     private final int value;
62
63
64     Autowire(int value) { this.value = value; }
65     
66     public int value() { return value; }
67     
68     /**
69      * Return whether this is a specified autowiring value
70      * @return was autowiring specified
71      */

72     public boolean isAutowire() {
73         return this == BY_NAME || this == BY_TYPE;
74     }
75
76 }
77
Popular Tags