@@ -51,6 +51,8 @@ public class FieldDefinition
51
51
private String initExpr = null ;
52
52
private boolean recursive = false ;
53
53
private Map <String ,Object > metaData ;
54
+ private String getterName = null ;
55
+ private String setterName = null ;
54
56
55
57
private List <AnnotationDefinition > annotations ;
56
58
@@ -104,6 +106,8 @@ public void readExternal(ObjectInput in) throws IOException,
104
106
this .priority = in .readInt ();
105
107
this .initExpr = (String ) in .readObject ();
106
108
this .metaData = (Map <String , Object >) in .readObject ();
109
+ this .getterName = ( String ) in .readObject ();
110
+ this .setterName = ( String ) in .readObject ();
107
111
}
108
112
109
113
public void writeExternal (ObjectOutput out ) throws IOException {
@@ -119,6 +123,8 @@ public void writeExternal(ObjectOutput out) throws IOException {
119
123
out .writeInt ( this .priority );
120
124
out .writeObject ( this .initExpr );
121
125
out .writeObject ( this .metaData );
126
+ out .writeObject ( this .getterName );
127
+ out .writeObject ( this .setterName );
122
128
}
123
129
124
130
/**
@@ -172,7 +178,10 @@ public void setKey(boolean key) {
172
178
* @return
173
179
*/
174
180
public String getReadMethod () {
175
- String prefix = null ;
181
+ if ( getterName != null ) {
182
+ return getterName ;
183
+ }
184
+ String prefix ;
176
185
if ( "boolean" .equals ( this .type ) ) {
177
186
prefix = "is" ;
178
187
} else {
@@ -188,8 +197,8 @@ public String getReadMethod() {
188
197
* @return
189
198
*/
190
199
public String getWriteMethod () {
191
- return "set" + this . name . substring ( 0 ,
192
- 1 ).toUpperCase () + this .name .substring ( 1 );
200
+ return setterName != null ? setterName :
201
+ "set" + this . name . substring ( 0 , 1 ).toUpperCase () + this .name .substring ( 1 );
193
202
}
194
203
195
204
/**
@@ -530,4 +539,19 @@ public void setOverriding( String overriding ) {
530
539
this .overriding = overriding ;
531
540
}
532
541
542
+ public String getGetterName () {
543
+ return getterName ;
544
+ }
545
+
546
+ public void setGetterName ( String getterName ) {
547
+ this .getterName = getterName ;
548
+ }
549
+
550
+ public String getSetterName () {
551
+ return setterName ;
552
+ }
553
+
554
+ public void setSetterName ( String setterName ) {
555
+ this .setterName = setterName ;
556
+ }
533
557
}
0 commit comments