Skip to content

Guide to Generated Classes

Ben Fagin edited this page Mar 31, 2015 · 8 revisions

The process of rendering Descriptors to source code creates a few different types of classes...

*Generator -> contains the static method used to get a new instance of your builder (one per descriptor)

*Helper -> these are the Helper interfaces which need to be implemented for your builder to function (one per block)

*Builder.Start -> convenience 'wrapper' class extending the starting state, which is the block with all of its methods before any of them have been called (one per descriptor)

*Builder... -> interfaces which define the skeleton of your API, containing the useful information like methods, documentation, and the reflective information Flapi needs to execute your builder at runtime (one or more per block)

*Factory -> interface which contains a single parameter-less method for instantiating a new builder

All of these names can be customized by providing your own NameGenerator instance.

In version 0.4 part of the generated code moved to a shared runtime. If you want to generate the runtime classes as well (to avoid creating a transitive dependency for consumers of your API) you can use the ExtractRuntime class to write these files out. You can include the .java source files with the writeRequiredSources(..) method, and the compiled .class files with writeRequiredClasses(..).

Clone this wiki locally