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.maven.plugin.descriptor;
20  
21  /**
22   * @author Jason van Zyl
23   */
24  public class Parameter implements Cloneable {
25      private String alias;
26  
27      private String name;
28  
29      private String type;
30  
31      private boolean required;
32  
33      private boolean editable = true;
34  
35      private String description;
36  
37      private String expression;
38  
39      private String deprecated;
40  
41      private String defaultValue;
42  
43      private String implementation;
44  
45      private Requirement requirement;
46  
47      private String since;
48  
49      // ----------------------------------------------------------------------
50      //
51      // ----------------------------------------------------------------------
52  
53      public String getName() {
54          return name;
55      }
56  
57      public void setName(String name) {
58          this.name = name;
59      }
60  
61      public String getType() {
62          return type;
63      }
64  
65      public void setType(String type) {
66          this.type = type;
67      }
68  
69      public boolean isRequired() {
70          return required;
71      }
72  
73      public void setRequired(boolean required) {
74          this.required = required;
75      }
76  
77      public String getDescription() {
78          return description;
79      }
80  
81      public void setDescription(String description) {
82          this.description = description;
83      }
84  
85      public String getExpression() {
86          return expression;
87      }
88  
89      public void setExpression(String expression) {
90          this.expression = expression;
91      }
92  
93      public String getDeprecated() {
94          return deprecated;
95      }
96  
97      public void setDeprecated(String deprecated) {
98          this.deprecated = deprecated;
99      }
100 
101     public int hashCode() {
102         return name.hashCode();
103     }
104 
105     public boolean equals(Object other) {
106         return (other instanceof Parameter) && getName().equals(((Parameter) other).getName());
107     }
108 
109     public String getAlias() {
110         return alias;
111     }
112 
113     public void setAlias(String alias) {
114         this.alias = alias;
115     }
116 
117     public boolean isEditable() {
118         return editable;
119     }
120 
121     public void setEditable(boolean editable) {
122         this.editable = editable;
123     }
124 
125     public void setDefaultValue(String defaultValue) {
126         this.defaultValue = defaultValue;
127     }
128 
129     public String getDefaultValue() {
130         return defaultValue;
131     }
132 
133     public String toString() {
134         return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']";
135     }
136 
137     public Requirement getRequirement() {
138         return requirement;
139     }
140 
141     public void setRequirement(Requirement requirement) {
142         this.requirement = requirement;
143     }
144 
145     public String getImplementation() {
146         return implementation;
147     }
148 
149     public void setImplementation(String implementation) {
150         this.implementation = implementation;
151     }
152 
153     public String getSince() {
154         return since;
155     }
156 
157     public void setSince(String since) {
158         this.since = since;
159     }
160 
161     /**
162      * Creates a shallow copy of this parameter.
163      */
164     @Override
165     public Parameter clone() {
166         try {
167             return (Parameter) super.clone();
168         } catch (CloneNotSupportedException e) {
169             throw new UnsupportedOperationException(e);
170         }
171     }
172 }