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.io.Serializable;
22  import java.util.ArrayList;
23  import java.util.Collection;
24  import java.util.Collections;
25  import java.util.List;
26  
27  /**
28   * @author Martin Marinschek
29   * @version $Revision: 1187700 $ $Date: 2011-10-22 07:19:37 -0500 (Sat, 22 Oct 2011) $
30   *
31       The "property" element represents a JavaBean property of the Java class
32       represented by our parent element.
33  
34       Property names must be unique within the scope of the Java class
35       that is represented by the parent element, and must correspond to
36       property names that will be recognized when performing introspection
37       against that class via java.beans.Introspector.
38  
39      <!ELEMENT property        (description*, display-name*, icon*, property-name, property-class, default-value?, suggested-value?, property-extension*)>
40  
41   *          <p/>
42   */
43  public class Property extends org.apache.myfaces.config.element.Property implements Serializable
44  {
45      private List<String> _description;
46      private List<String> _displayName;
47      private List<String> _icon;
48      private String _propertyName;
49      private String _propertyClass;
50      private String _defaultValue;
51      private String _suggestedValue;
52      private List<String> _propertyExtension;
53  
54  
55      public void addDescription(String value)
56      {
57          if(_description == null)
58              _description = new ArrayList<String>();
59  
60          _description.add(value);
61      }
62  
63      public Collection<? extends String> getDescriptions()
64      {
65          if(_description == null)
66          {
67              return Collections.emptyList();
68          }
69  
70          return _description;
71      }
72  
73      public void addDisplayName(String value)
74      {
75          if(_displayName == null)
76          {
77              _displayName = new ArrayList<String>();
78          }
79  
80          _displayName.add(value);
81      }
82  
83      public Collection<? extends String> getDisplayNames()
84      {
85          if(_displayName==null)
86          {
87              return Collections.emptyList();
88          }
89  
90          return _displayName;
91      }
92  
93      public void addIcon(String value)
94      {
95          if(_icon == null)
96          {
97              _icon = new ArrayList<String>();
98          }
99  
100         _icon.add(value);
101     }
102 
103     public Collection<? extends String> getIcons()
104     {
105         if(_icon == null)
106         {
107             return Collections.emptyList();
108         }
109 
110         return _icon;
111     }
112 
113     public void setPropertyName(String propertyName)
114     {
115         _propertyName = propertyName;
116     }
117 
118     public String getPropertyName()
119     {
120         return _propertyName;
121     }
122 
123     public void setPropertyClass(String propertyClass)
124     {
125         _propertyClass = propertyClass;
126     }
127 
128     public String getPropertyClass()
129     {
130         return _propertyClass;
131     }
132 
133     public void setDefaultValue(String defaultValue)
134     {
135         _defaultValue = defaultValue;
136     }
137 
138     public String getDefaultValue()
139     {
140         return _defaultValue;
141     }
142 
143     public void setSuggestedValue(String suggestedValue)
144     {
145         _suggestedValue = suggestedValue;
146     }
147 
148     public String getSuggestedValue()
149     {
150         return _suggestedValue;
151     }
152 
153     public void addPropertyExtension(String propertyExtension)
154     {
155         if(_propertyExtension == null)
156         {
157             _propertyExtension = new ArrayList<String>();
158         }
159 
160         _propertyExtension.add(propertyExtension);
161     }
162 
163     public Collection<? extends String> getPropertyExtensions()
164     {
165         if(_propertyExtension == null)
166         {
167             return Collections.emptyList();
168         }
169 
170         return _propertyExtension;
171     }
172 
173 }