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