KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > config > impl > digester > elements > ManagedBean


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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 package org.apache.myfaces.config.impl.digester.elements;
17
18 import org.apache.myfaces.util.ClassUtils;
19
20 import java.util.ArrayList JavaDoc;
21 import java.util.Iterator JavaDoc;
22 import java.util.List JavaDoc;
23
24
25 /**
26  * @author <a HREF="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
27  */

28 public class ManagedBean implements org.apache.myfaces.config.element.ManagedBean
29 {
30
31     private String JavaDoc name;
32     private String JavaDoc beanClassName;
33     private Class JavaDoc beanClass;
34     private String JavaDoc scope;
35     private List JavaDoc property = new ArrayList JavaDoc();
36     private MapEntries mapEntries;
37     private ListEntries listEntries;
38
39
40     public int getInitMode()
41     {
42         if (mapEntries != null) {
43             return INIT_MODE_MAP;
44         }
45         if (listEntries != null) {
46             return INIT_MODE_LIST;
47         }
48         if (! property.isEmpty()) {
49             return INIT_MODE_PROPERTIES;
50         }
51         return INIT_MODE_NO_INIT;
52     }
53
54
55
56     public org.apache.myfaces.config.element.MapEntries getMapEntries()
57     {
58         return mapEntries;
59     }
60
61
62     public void setMapEntries(MapEntries mapEntries)
63     {
64         this.mapEntries = mapEntries;
65     }
66
67
68     public org.apache.myfaces.config.element.ListEntries getListEntries()
69     {
70         return listEntries;
71     }
72
73
74     public void setListEntries(ListEntries listEntries)
75     {
76         this.listEntries = listEntries;
77     }
78
79
80     public String JavaDoc getManagedBeanName()
81     {
82         return name;
83     }
84
85
86     public void setName(String JavaDoc name)
87     {
88         this.name = name;
89     }
90
91
92     public String JavaDoc getManagedBeanClassName()
93     {
94         return beanClassName;
95     }
96
97
98     public Class JavaDoc getManagedBeanClass()
99     {
100         if (beanClassName == null)
101         {
102             return null;
103         }
104         if (beanClass == null)
105         {
106             beanClass = ClassUtils.simpleClassForName(beanClassName);
107         }
108         return beanClass;
109     }
110
111
112     public void setBeanClass(String JavaDoc beanClass)
113     {
114         this.beanClassName = beanClass;
115     }
116
117
118     public String JavaDoc getManagedBeanScope()
119     {
120         return scope;
121     }
122
123
124     public void setScope(String JavaDoc scope)
125     {
126         this.scope = scope;
127     }
128
129
130     public void addProperty(ManagedProperty value)
131     {
132         property.add(value);
133     }
134
135
136     public Iterator JavaDoc getManagedProperties()
137     {
138         return property.iterator();
139     }
140 }
141
Popular Tags