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