Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Plugin Development

Shaun Francis edited this page Sep 15, 2017 · 7 revisions

Class Modifying Plugin

All Class Generator Plugins implement the ClassGeneratorPlugin interface:

public interface ClassModifyingPlugin {

    /**
     * Modifies the generation of a class.
     *
     * @param classBuilder A builder for generating the class
     * @param classDefinition The definition of the class from the json schema document
     * @param pluginContext Access to any data the plugin might need
     *
     * @return The modified class's {@link TypeSpec} builder
     */
    TypeSpec.Builder generateWith(final TypeSpec.Builder classBuilder,
                                  final ClassDefinition classDefinition,
                                  final PluginContext pluginContext);
}

Type Modifying Plugins

All Type Name Plugins implement the TypeNamePlugin interface:

public interface TypeModifyingPlugin {

    /**
     * Modifies the TypeName (used as constructor parameters and getter return types) of
     * generated classes in some way.
     *
     * @param typeName The type name to be modified
     * @param definition The FieldDefinition of the type to be modified
     *
     * @return The modified type name
     */
    TypeName modifyTypeName(final TypeName typeName, final Definition definition);
}
Clone this wiki locally