Class ConfigurableSmithyBuildPlugin<T>

java.lang.Object
software.amazon.smithy.build.plugins.ConfigurableSmithyBuildPlugin<T>
Type Parameters:
T - The configuration setting type (e.g., a POJO).
All Implemented Interfaces:
SmithyBuildPlugin

public abstract class ConfigurableSmithyBuildPlugin<T> extends Object implements SmithyBuildPlugin
An abstract class used to more easily implement a Smithy build plugin that expects configuration input in a specific type, T.

This class will automatically deserialize the given Node value in the T and invoke executeWithConfig(PluginContext, Object) with the deserialized configuration of type T.

If your build plugin requires configuration, then you typically should just extend this class.

  • Constructor Details

    • ConfigurableSmithyBuildPlugin

      public ConfigurableSmithyBuildPlugin()
  • Method Details

    • getConfigType

      public abstract Class<T> getConfigType()
      Gets the configuration class type.

      The referenced configType class must be a public POJO with a public, zero-arg constructor, getters, and setters. If the POJO has a public static fromNode method, it will be invoked and is expected to deserialize the Node. If the POJO has a public static builder method, it will be invoked, setters will be called on the builder POJO, and finally the result of calling the build method is used as the configuration type. Finally, the deserializer will attempt to create the type and call setters on it that correspond to property names.

      Returns:
      Returns the configuration class (a POJO with setters/getters).
    • execute

      public void execute(PluginContext context)
      Description copied from interface: SmithyBuildPlugin
      Executes the plugin, creating any number of artifacts.
      Specified by:
      execute in interface SmithyBuildPlugin
      Parameters:
      context - Plugin context for build execution.
    • executeWithConfig

      protected abstract void executeWithConfig(PluginContext context, T config)
      Executes the plugin using the deserialized configuration object.
      Parameters:
      context - Plugin context.
      config - Deserialized configuration object.