Java code in transformation moved to a class

This allows IDE to "see" the code so you can use its features (syntax
highlighting, code completion etc.) plus the parser doesn't to be
regenerated when the grammar is not changed.