I developed the codegen utility for Querydsl which mirrors Java domain types into query types. So the serialization needs are very complex. Using FreeMarker templates simple didn't scale. There was too much customization in the output, which is better to control in Java than a template language syntax.

This is not an advertisement for the Codegen module. I just wanted to make the point that for highly customizable serialization FreeMarker might not scale.