001: /*
002: * Copyright 2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.apache.myfaces.config.impl.digester.elements;
017:
018: import java.util.List;
019: import java.util.ArrayList;
020: import java.util.Iterator;
021: import java.util.Collections;
022:
023: /**
024: * @author Martin Marinschek
025: * @version $Revision: 511033 $ $Date: 2007-02-23 18:41:52 +0100 (Fr, 23 Feb 2007) $
026: *
027: The "property" element represents a JavaBean property of the Java class
028: represented by our parent element.
029:
030: Property names must be unique within the scope of the Java class
031: that is represented by the parent element, and must correspond to
032: property names that will be recognized when performing introspection
033: against that class via java.beans.Introspector.
034:
035: <!ELEMENT property (description*, display-name*, icon*, property-name, property-class, default-value?, suggested-value?, property-extension*)>
036:
037: * <p/>
038: */
039: public class Property {
040: private List<String> _description;
041: private List<String> _displayName;
042: private List<String> _icon;
043: private String _propertyName;
044: private String _propertyClass;
045: private String _defaultValue;
046: private String _suggestedValue;
047: private List<String> _propertyExtension;
048:
049: public void addDescription(String value) {
050: if (_description == null)
051: _description = new ArrayList<String>();
052:
053: _description.add(value);
054: }
055:
056: public Iterator<String> getDescriptions() {
057: if (_description == null)
058: return Collections.EMPTY_LIST.iterator();
059:
060: return _description.iterator();
061: }
062:
063: public void addDisplayName(String value) {
064: if (_displayName == null)
065: _displayName = new ArrayList<String>();
066:
067: _displayName.add(value);
068: }
069:
070: public Iterator<String> getDisplayNames() {
071: if (_displayName == null)
072: return Collections.EMPTY_LIST.iterator();
073:
074: return _displayName.iterator();
075: }
076:
077: public void addIcon(String value) {
078: if (_icon == null)
079: _icon = new ArrayList<String>();
080:
081: _icon.add(value);
082: }
083:
084: public Iterator<String> getIcons() {
085: if (_icon == null)
086: return Collections.EMPTY_LIST.iterator();
087:
088: return _icon.iterator();
089: }
090:
091: public void setPropertyName(String propertyName) {
092: _propertyName = propertyName;
093: }
094:
095: public String getPropertyName() {
096: return _propertyName;
097: }
098:
099: public void setPropertyClass(String propertyClass) {
100: _propertyClass = propertyClass;
101: }
102:
103: public String getPropertyClass() {
104: return _propertyClass;
105: }
106:
107: public void setDefaultValue(String defaultValue) {
108: _defaultValue = defaultValue;
109: }
110:
111: public String getDefaultValue() {
112: return _defaultValue;
113: }
114:
115: public void setSuggestedValue(String suggestedValue) {
116: _suggestedValue = suggestedValue;
117: }
118:
119: public String getSuggestedValue() {
120: return _suggestedValue;
121: }
122:
123: public void addPropertyExtension(String propertyExtension) {
124: if (_propertyExtension == null)
125: _propertyExtension = new ArrayList<String>();
126:
127: _propertyExtension.add(propertyExtension);
128: }
129:
130: public Iterator<String> getPropertyExtensions() {
131: if (_propertyExtension == null)
132: return Collections.EMPTY_LIST.iterator();
133:
134: return _propertyExtension.iterator();
135: }
136:
137: }
|