rate source code by populating the 'cm' tree. cm._class(...); ... // write them out cm.build(new File("."));
Every CodeModel node is always owned by one {@link JCodeModel} objectat any given time (which can be often accesesd by the owner() method.) As such, when you generate Java code, most of the operation works in a top-down fashion. For example, you create a class from {@link JCodeModel}, which gives you a {@link JDefinedClass}. Then you invoke a method on it to generate a new method, which gives you {@link JMethod}, and so on. There are a few exceptions to this, most notably building {@link JExpression}s, but generally you work with CodeModel in a top-down fashion. Because of this design, most of the CodeModel classes aren't directly instanciable.
Where to go from here?
Most of the time you'd want to populate new type definitions in a {@link JCodeModel}. See {@link #_class(String,ClassType)}.