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