001 // Copyright 2004, 2005 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.hivemind.parse;
016
017 import java.util.ArrayList;
018 import java.util.Collections;
019 import java.util.List;
020
021 import org.apache.hivemind.Element;
022 import org.apache.hivemind.util.ToStringBuilder;
023
024 /**
025 * Descriptor for <contribution> element.
026 *
027 * @author Howard Lewis Ship
028 */
029 public final class ContributionDescriptor extends BaseAnnotationHolder
030 {
031 private String _configurationId;
032
033 private List _elements;
034
035 /** @since 1.1 */
036 private String _conditionalExpression;
037
038 /**
039 * Returns the extension id, which may be a local id (simple name) or an extended id (including
040 * a module id prefix).
041 */
042 public String getConfigurationId()
043 {
044 return _configurationId;
045 }
046
047 public void setConfigurationId(String string)
048 {
049 _configurationId = string;
050 }
051
052 public String toString()
053 {
054 ToStringBuilder builder = new ToStringBuilder(this);
055 builder.append("configurationId", _configurationId);
056 builder.append("conditionalExpression", _conditionalExpression);
057
058 return builder.toString();
059 }
060
061 public void addElement(Element element)
062 {
063 if (_elements == null)
064 _elements = new ArrayList();
065
066 _elements.add(element);
067 }
068
069 public List getElements()
070 {
071 if (_elements == null)
072 return Collections.EMPTY_LIST;
073
074 return _elements;
075 }
076
077 /** @since 1.1 */
078 public String getConditionalExpression()
079 {
080 return _conditionalExpression;
081 }
082
083 /** @since 1.1 */
084 public void setConditionalExpression(String conditionalExpression)
085 {
086 _conditionalExpression = conditionalExpression;
087 }
088 }