in plugin/src/main/groovy/grails/plugins/redis/ast/MemoizeObjectASTTransformation.groovy [96:114]
private BlockStatement addFromJson(BlockStatement body, Map memoizeProperties){
// last statement should be the redisService.memoize(...){...} call
List stmts = body.getStatements()
ArgumentListExpression fromJsonArgList = new ArgumentListExpression()
fromJsonArgList.addExpression(stmts[-1].expression)
fromJsonArgList.addExpression((Expression) memoizeProperties.get(CLAZZ))
// new Gson().fromJson(..., <return type>.class)
ReturnStatement fromJsonStatement = new ReturnStatement(
new MethodCallExpression(
createGson(),
new ConstantExpression('fromJson'),
fromJsonArgList
)
)
stmts[-1] = fromJsonStatement
new BlockStatement(stmts as Statement[], new VariableScope())
}