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  public class AttributeImpl extends org.apache.myfaces.config.element.Attribute implements Serializable
32  {
33      private List<String> _description;
34      private List<String> _displayName;
35      private List<String> _icon;
36      private String _attributeName;
37      private String _attributeClass;
38      private String _defaultValue;
39      private String _suggestedValue;
40      private List<String> _attributeExtension;
41  
42  
43      public void addDescription(String value)
44      {
45          if(_description == null)
46          {
47              _description = new ArrayList<String>();
48          }
49          
50          _description.add(value);
51      }
52  
53      public Collection<? extends String> getDescriptions()
54      {
55          if(_description == null)
56          {
57              return Collections.emptyList();
58          }
59          
60          return _description;
61      }
62  
63      public void addDisplayName(String value)
64      {
65          if(_displayName == null)
66          {
67              _displayName = new ArrayList<String>();
68          }
69  
70          _displayName.add(value);
71      }
72  
73      public Collection<? extends String> getDisplayNames()
74      {
75          if(_displayName == null)
76          {
77              return Collections.emptyList();
78          }
79          
80          return _displayName;
81      }
82  
83      public void addIcon(String value)
84      {
85          if(_icon == null)
86          {
87              _icon = new ArrayList<String>();
88          }
89          
90          _icon.add(value);
91      }
92  
93      public Collection<? extends String> getIcons()
94      {
95          if(_icon == null)
96          {
97              return Collections.emptyList();
98          }
99  
100         return _icon;
101     }
102 
103     public void setAttributeName(String attributeName)
104     {
105         _attributeName = attributeName;
106     }
107 
108     public String getAttributeName()
109     {
110         return _attributeName;
111     }
112 
113     public void setAttributeClass(String attributeClass)
114     {
115         _attributeClass = attributeClass;
116     }
117 
118     public String getAttributeClass()
119     {
120         return _attributeClass;
121     }
122 
123     public void setDefaultValue(String defaultValue)
124     {
125         _defaultValue = defaultValue;
126     }
127 
128     public String getDefaultValue()
129     {
130         return _defaultValue;
131     }
132 
133     public void setSuggestedValue(String suggestedValue)
134     {
135         _suggestedValue = suggestedValue;
136     }
137 
138     public String getSuggestedValue()
139     {
140         return _suggestedValue;
141     }
142 
143     public void addAttributeExtension(String attributeExtension)
144     {
145         if(_attributeExtension == null)
146         {
147             _attributeExtension = new ArrayList<String>();
148         }
149 
150         _attributeExtension.add(attributeExtension);
151     }
152 
153     public Collection<? extends String> getAttributeExtensions()
154     {
155         if(_attributeExtension == null)
156         {
157             return Collections.emptyList();
158         }
159 
160         return _attributeExtension;
161     }
162 }