readFields.setNative(false);
readFields.setReturnType(context.getVoid());
readFields.setStatic(false);
readFields.setVisibility(Visibility.PROTECTED);
final NewMethodParameter readFieldsJsonObjectParameter = readFields.newParameter();
readFieldsJsonObjectParameter.setFinal(true);
readFieldsJsonObjectParameter.setName("jsonObject");
final Type jsonObjectType = this.getJsonObject();
readFieldsJsonObjectParameter.setType(jsonObjectType);
final NewMethodParameter readFieldsInstanceParameter = readFields.newParameter();
readFieldsInstanceParameter.setFinal(true);
readFieldsInstanceParameter.setName("instance");
readFieldsInstanceParameter.setType(type);
final CodeBlockList body = new CodeBlockList();
readFields.setBody(body);
final Type stringType = context.getString();
final Iterator fields = type.getFields().iterator();
while (fields.hasNext()) {
final Field field = (Field) fields.next();
if (field.isStatic() || field.isTransient()) {
continue;
}
if (field.isFinal()) {
throwFinalFieldsCannotBeDeserialized(field);
}
final SetFieldTemplatedFile writeMethodBody = new SetFieldTemplatedFile();
writeMethodBody.setField(field);
// create the setter method itself.
final NewMethod setter = deserializer.newMethod();
setter.setAbstract(false);
setter.setFinal(false);
setter.setName(GeneratorHelper.buildSetterName(field.getName()));
setter.setNative(true);
setter.setReturnType(context.getVoid());
setter.setStatic(false);
setter.setVisibility(Visibility.PRIVATE);
setter.setBody(writeMethodBody);
// add its instance parameter
final NewMethodParameter setterInstanceParameter = setter.newParameter();
setterInstanceParameter.setFinal(true);
setterInstanceParameter.setName(Constants.SET_FIELD_INSTANCE_PARAMETER);
setterInstanceParameter.setType(type);
// add the value parameter
final NewMethodParameter setterValueParameter = setter.newParameter();
setterValueParameter.setFinal(true);
setterValueParameter.setName(Constants.SET_FIELD_VALUE_PARAMETER);
setterValueParameter.setType(field.getType());
final Type fieldType = field.getType();
if (fieldType.equals(context.getLong())) {
setter.addMetaData("com.google.gwt.core.client.UnsafeNativeLong", "");