1 package org.apache.maven.tools.plugin.annotations.datamodel;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugins.annotations.Parameter;
23 import org.codehaus.plexus.util.StringUtils;
24
25 import java.lang.annotation.Annotation;
26
27
28
29
30
31 public class ParameterAnnotationContent
32 extends AnnotatedField
33 implements Parameter
34 {
35
36 private String name;
37
38 private String alias;
39
40 private String property;
41
42 private String defaultValue;
43
44 private boolean required = false;
45
46 private boolean readonly = false;
47
48 private String className;
49
50 public ParameterAnnotationContent( String fieldName, String className )
51 {
52 super( fieldName );
53 this.className = className;
54 }
55
56 public ParameterAnnotationContent( String fieldName, String alias, String property, String defaultValue,
57 boolean required, boolean readonly, String className )
58 {
59 this( fieldName, className );
60 this.alias = alias;
61 this.property = property;
62 this.defaultValue = defaultValue;
63 this.required = required;
64 this.readonly = readonly;
65 }
66
67 public String name()
68 {
69 return name;
70 }
71
72 public void name( String name )
73 {
74 this.name = name;
75 }
76
77 public String alias()
78 {
79 return alias;
80 }
81
82 public void alias( String alias )
83 {
84 this.alias = alias;
85 }
86
87 public String property()
88 {
89 return property;
90 }
91
92 public void property( String property )
93 {
94 this.property = property;
95 }
96
97 public String defaultValue()
98 {
99 return defaultValue;
100 }
101
102 public void defaultValue( String defaultValue )
103 {
104 this.defaultValue = defaultValue;
105 }
106
107 public boolean required()
108 {
109 return required;
110 }
111
112 public void required( boolean required )
113 {
114 this.required = required;
115 }
116
117 public boolean readonly()
118 {
119 return readonly;
120 }
121
122 public void readonly( boolean readonly )
123 {
124 this.readonly = readonly;
125 }
126
127 public Class<? extends Annotation> annotationType()
128 {
129 return null;
130 }
131
132 public String getClassName()
133 {
134 return className;
135 }
136
137 public void setClassName( String className )
138 {
139 this.className = className;
140 }
141
142 @Override
143 public String toString()
144 {
145 final StringBuilder sb = new StringBuilder();
146 sb.append( super.toString() );
147 sb.append( "ParameterAnnotationContent" );
148 sb.append( "{name='" ).append( name ).append( '\'' );
149 sb.append( ", alias='" ).append( alias ).append( '\'' );
150 sb.append( ", property='" ).append( property ).append( '\'' );
151 sb.append( ", defaultValue='" ).append( defaultValue ).append( '\'' );
152 sb.append( ", required=" ).append( required );
153 sb.append( ", readonly=" ).append( readonly );
154 sb.append( '}' );
155 return sb.toString();
156 }
157
158 @Override
159 public boolean equals( Object o )
160 {
161 if ( this == o )
162 {
163 return true;
164 }
165 if ( !( o instanceof ParameterAnnotationContent ) )
166 {
167 return false;
168 }
169
170 ParameterAnnotationContent that = (ParameterAnnotationContent) o;
171
172 if ( readonly != that.readonly )
173 {
174 return false;
175 }
176 if ( required != that.required )
177 {
178 return false;
179 }
180
181 if ( getFieldName() != null ? !getFieldName().equals( that.getFieldName() ) : that.getFieldName() != null )
182 {
183 return false;
184 }
185
186 if ( alias != null ? !alias.equals( that.alias ) : that.alias != null )
187 {
188 return false;
189 }
190 if ( defaultValue != null ? !defaultValue.equals( that.defaultValue ) : that.defaultValue != null )
191 {
192 return false;
193 }
194 if ( property != null ? !property.equals( that.property ) : that.property != null )
195 {
196 return false;
197 }
198
199 return true;
200 }
201
202 @Override
203 public int hashCode()
204 {
205 int result = alias != null ? alias.hashCode() : 0;
206 result = 31 * result + ( getFieldName() != null ? getFieldName().hashCode() : 0 );
207 result = 31 * result + ( property != null ? property.hashCode() : 0 );
208 result = 31 * result + ( defaultValue != null ? defaultValue.hashCode() : 0 );
209 result = 31 * result + ( required ? 1 : 0 );
210 result = 31 * result + ( readonly ? 1 : 0 );
211 return result;
212 }
213 }