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