001    package org.apache.maven.plugin.descriptor;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *  http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    /**
023     * @author Jason van Zyl
024     */
025    public class Parameter
026        implements Cloneable
027    {
028        private String alias;
029    
030        private String name;
031    
032        private String type;
033    
034        private boolean required;
035    
036        private boolean editable = true;
037    
038        private String description;
039    
040        private String expression;
041    
042        private String deprecated;
043    
044        private String defaultValue;
045    
046        private String implementation;
047    
048        private Requirement requirement;
049    
050        private String since;
051    
052        // ----------------------------------------------------------------------
053        //
054        // ----------------------------------------------------------------------
055    
056        public String getName()
057        {
058            return name;
059        }
060    
061        public void setName( String name )
062        {
063            this.name = name;
064        }
065    
066        public String getType()
067        {
068            return type;
069        }
070    
071        public void setType( String type )
072        {
073            this.type = type;
074        }
075    
076        public boolean isRequired()
077        {
078            return required;
079        }
080    
081        public void setRequired( boolean required )
082        {
083            this.required = required;
084        }
085    
086        public String getDescription()
087        {
088            return description;
089        }
090    
091        public void setDescription( String description )
092        {
093            this.description = description;
094        }
095    
096        public String getExpression()
097        {
098            return expression;
099        }
100    
101        public void setExpression( String expression )
102        {
103            this.expression = expression;
104        }
105    
106        public String getDeprecated()
107        {
108            return deprecated;
109        }
110    
111        public void setDeprecated( String deprecated )
112        {
113            this.deprecated = deprecated;
114        }
115    
116        public int hashCode()
117        {
118            return name.hashCode();
119        }
120    
121        public boolean equals( Object other )
122        {
123            return ( other instanceof Parameter ) && getName().equals( ( (Parameter) other ).getName() );
124        }
125    
126        public String getAlias()
127        {
128            return alias;
129        }
130    
131        public void setAlias( String alias )
132        {
133            this.alias = alias;
134        }
135    
136        public boolean isEditable()
137        {
138            return editable;
139        }
140    
141        public void setEditable( boolean editable )
142        {
143            this.editable = editable;
144        }
145    
146        public void setDefaultValue( String defaultValue )
147        {
148            this.defaultValue = defaultValue;
149        }
150    
151        public String getDefaultValue()
152        {
153            return defaultValue;
154        }
155    
156        public String toString()
157        {
158            return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']";
159        }
160    
161        public Requirement getRequirement()
162        {
163            return requirement;
164        }
165    
166        public void setRequirement( Requirement requirement )
167        {
168            this.requirement = requirement;
169        }
170    
171        public String getImplementation()
172        {
173            return implementation;
174        }
175    
176        public void setImplementation( String implementation )
177        {
178            this.implementation = implementation;
179        }
180    
181        public String getSince()
182        {
183            return since;
184        }
185    
186        public void setSince( String since )
187        {
188            this.since = since;
189        }
190    
191        /**
192         * Creates a shallow copy of this parameter.
193         */
194        @Override
195        public Parameter clone()
196        {
197            try
198            {
199                return (Parameter) super.clone();
200            }
201            catch ( CloneNotSupportedException e )
202            {
203                throw new UnsupportedOperationException( e );
204            }
205        }
206    
207    }