View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.config.impl.digester.elements;
20  
21  import java.util.List;
22  import java.util.ArrayList;
23  import java.util.Iterator;
24  import java.util.Collections;
25  
26  /**
27   * @author Martin Marinschek
28   * @version $Revision: 684459 $ $Date: 2008-08-10 06:13:56 -0500 (Sun, 10 Aug 2008) $
29   *
30       The "property" element represents a JavaBean property of the Java class
31       represented by our parent element.
32  
33       Property names must be unique within the scope of the Java class
34       that is represented by the parent element, and must correspond to
35       property names that will be recognized when performing introspection
36       against that class via java.beans.Introspector.
37  
38      <!ELEMENT property        (description*, display-name*, icon*, property-name, property-class, default-value?, suggested-value?, property-extension*)>
39  
40   *          <p/>
41   */
42  public class Property
43  {
44      private List<String> _description;
45      private List<String> _displayName;
46      private List<String> _icon;
47      private String _propertyName;
48      private String _propertyClass;
49      private String _defaultValue;
50      private String _suggestedValue;
51      private List<String> _propertyExtension;
52  
53  
54      public void addDescription(String value)
55      {
56          if(_description == null)
57              _description = new ArrayList<String>();
58  
59          _description.add(value);
60      }
61  
62      public Iterator<String> getDescriptions()
63      {
64          if(_description==null)
65              return Collections.EMPTY_LIST.iterator();
66  
67          return _description.iterator();
68      }
69  
70      public void addDisplayName(String value)
71      {
72          if(_displayName == null)
73              _displayName = new ArrayList<String>();
74  
75          _displayName.add(value);
76      }
77  
78      public Iterator<String> getDisplayNames()
79      {
80          if(_displayName==null)
81              return Collections.EMPTY_LIST.iterator();
82  
83          return _displayName.iterator();
84      }
85  
86      public void addIcon(String value)
87      {
88          if(_icon == null)
89              _icon = new ArrayList<String>();
90  
91          _icon.add(value);
92      }
93  
94      public Iterator<String> getIcons()
95      {
96          if(_icon==null)
97              return Collections.EMPTY_LIST.iterator();
98  
99          return _icon.iterator();
100     }
101 
102     public void setPropertyName(String propertyName)
103     {
104         _propertyName = propertyName;
105     }
106 
107     public String getPropertyName()
108     {
109         return _propertyName;
110     }
111 
112     public void setPropertyClass(String propertyClass)
113     {
114         _propertyClass = propertyClass;
115     }
116 
117     public String getPropertyClass()
118     {
119         return _propertyClass;
120     }
121 
122     public void setDefaultValue(String defaultValue)
123     {
124         _defaultValue = defaultValue;
125     }
126 
127     public String getDefaultValue()
128     {
129         return _defaultValue;
130     }
131 
132     public void setSuggestedValue(String suggestedValue)
133     {
134         _suggestedValue = suggestedValue;
135     }
136 
137     public String getSuggestedValue()
138     {
139         return _suggestedValue;
140     }
141 
142     public void addPropertyExtension(String propertyExtension)
143     {
144         if(_propertyExtension == null)
145             _propertyExtension = new ArrayList<String>();
146 
147         _propertyExtension.add(propertyExtension);
148     }
149 
150     public Iterator<String> getPropertyExtensions()
151     {
152         if(_propertyExtension==null)
153             return Collections.EMPTY_LIST.iterator();
154 
155         return _propertyExtension.iterator();
156     }
157 
158 }