CodeModel is a Java library for code generators
CodeModel is a Java library for code generators; it provides a way to generate Java programs in a way much nicer than PrintStream.println(). This project is a spin-off from the JAXB RI for its schema compiler to generate Java source files.
Every CodeModel node is always owned by one JCodeModel object at 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 JCodeModel, which gives you a JDefinedClass. Then you invoke a method on it to generate a new method, which gives you JMethod, and so on. There are a few exceptions to this, most notably building JExpressions, but generally you work with CodeModel in a top-down fashion. Because of this design, most of the CodeModel classes aren't directly instanciable.