-
Notifications
You must be signed in to change notification settings - Fork 2
Plugins
Plugins provide a means to change the Java Classes that are generated. There are three different types of plugin that can be added to the generator: ClassModifyingPlugin, TypeModifyPlugin and NameGeneratablePlugin. Each type works on a different stage of the generation process.
This works by applying changes to the Java Poet TypeSpec.Builder, before generation is completed. Two default plugins are setup: AddFieldsAndMethodsToClassPlugin, GenerateBuilderForClassPlugin.
Each field of a schema is represented by a Definition, and each type of Definition needs to converted into a Java Poet TypeName. The TypeModifyingPlugin receives the default or already modified TypeName, which can then be modified or a completely different TypeName can be returned.
There can only be one NameGeneratablePlugin present, it will decide the field name for the root schema, which will ultimately be used to generate the Class name of the root. There is a default plugin provided that uses the file name to construct the field name for the root. By adding a user defined plugin to the plugins list, this default plugin will be overridden.
- Provided Plugins - Description of provided plugins
- Plugin Development - How to develop a custom Plugins
- Definition - Description of the internal model used for generation