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$ $Date$
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,
40   * default-value?, suggested-value?, property-extension*)>
41   *
42   *          <p/>
43   */
44  public class PropertyImpl extends org.apache.myfaces.config.element.Property implements Serializable
45  {
46      private List<String> _description;
47      private List<String> _displayName;
48      private List<String> _icon;
49      private String _propertyName;
50      private String _propertyClass;
51      private String _defaultValue;
52      private String _suggestedValue;
53      private List<String> _propertyExtension;
54  
55  
56      public void addDescription(String value)
57      {
58          if(_description == null)
59          {
60              _description = new ArrayList<String>();
61          }
62  
63          _description.add(value);
64      }
65  
66      public Collection<? extends String> getDescriptions()
67      {
68          if(_description == null)
69          {
70              return Collections.emptyList();
71          }
72  
73          return _description;
74      }
75  
76      public void addDisplayName(String value)
77      {
78          if(_displayName == null)
79          {
80              _displayName = new ArrayList<String>();
81          }
82  
83          _displayName.add(value);
84      }
85  
86      public Collection<? extends String> getDisplayNames()
87      {
88          if(_displayName==null)
89          {
90              return Collections.emptyList();
91          }
92  
93          return _displayName;
94      }
95  
96      public void addIcon(String value)
97      {
98          if(_icon == null)
99          {
100             _icon = new ArrayList<String>();
101         }
102 
103         _icon.add(value);
104     }
105 
106     public Collection<? extends String> getIcons()
107     {
108         if(_icon == null)
109         {
110             return Collections.emptyList();
111         }
112 
113         return _icon;
114     }
115 
116     public void setPropertyName(String propertyName)
117     {
118         _propertyName = propertyName;
119     }
120 
121     public String getPropertyName()
122     {
123         return _propertyName;
124     }
125 
126     public void setPropertyClass(String propertyClass)
127     {
128         _propertyClass = propertyClass;
129     }
130 
131     public String getPropertyClass()
132     {
133         return _propertyClass;
134     }
135 
136     public void setDefaultValue(String defaultValue)
137     {
138         _defaultValue = defaultValue;
139     }
140 
141     public String getDefaultValue()
142     {
143         return _defaultValue;
144     }
145 
146     public void setSuggestedValue(String suggestedValue)
147     {
148         _suggestedValue = suggestedValue;
149     }
150 
151     public String getSuggestedValue()
152     {
153         return _suggestedValue;
154     }
155 
156     public void addPropertyExtension(String propertyExtension)
157     {
158         if(_propertyExtension == null)
159         {
160             _propertyExtension = new ArrayList<String>();
161         }
162 
163         _propertyExtension.add(propertyExtension);
164     }
165 
166     public Collection<? extends String> getPropertyExtensions()
167     {
168         if(_propertyExtension == null)
169         {
170             return Collections.emptyList();
171         }
172 
173         return _propertyExtension;
174     }
175 
176 }