context.debug("Created setter for field " + field + " setter method " + setter);
// simple type ?
if (fieldType.isPrimitive() || fieldType.equals(stringType)) {
final SetSimpleTemplatedFile template = new SetSimpleTemplatedFile();
template.setFieldSetter(setter);
template.setJavascriptPropertyName(this.getJavascriptPropertyName(field));
template.setSerializer(this.getSerializer(field));
body.add(template);
continue;
}
final SetComplexTemplatedFile template = new SetComplexTemplatedFile();
template.setFieldSetter(setter);
template.setJavascriptPropertyName(this.getJavascriptPropertyName(field));
template.setFieldType(fieldType);
final Type serializer = this.getSerializer(field);
template.setSerializer(serializer);
final String readMethodName = this.selectReadMethod(fieldType);
final Method readMethod = serializer.getMostDerivedMethod(readMethodName, Collections.nCopies(1, this.getJsonValue()));
template.setReadMethod(readMethod);
body.add(template);
}
context.unbranch();