Skip to Main Content
Language Implementation Patterns
book

Language Implementation Patterns

by Terence Parr
December 2009
Intermediate to advanced content levelIntermediate to advanced
380 pages
9h 2m
English
Pragmatic Bookshelf
Content preview from Language Implementation Patterns

Applying Templates to Lists of Data

Building an object-relational database mapping is an excellent use of code generation. In this section, we’re going to build one component of such a mapping by generating SQL schemas from Java class definitions. To keep things simple, we’ll restrict ourselves to fields whose Java types maps easily to SQL types (such as integers, strings, floats, doubles, and Date objects).

To build this generator, we’re going to use Java’s reflection API as an input model and create a nested template hierarchy as we did in the previous section. This application is going to require some new skills, though. We have to get comfortable sifting and filtering the input model and then applying templates to that data. Since ST is a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementation Patterns

Implementation Patterns

Kent Beck

Publisher Resources

ISBN: 9781680500097Errata Page