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 java.lang.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 theT
and invokeexecuteWithConfig(PluginContext, Object)
with the deserialized configuration of typeT
.If your build plugin requires configuration, then you typically should just extend this class.
-
-
Constructor Summary
Constructors Constructor Description ConfigurableSmithyBuildPlugin()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
execute(PluginContext context)
Executes the plugin, creating any number of artifacts.protected abstract void
executeWithConfig(PluginContext context, T config)
Executes the plugin using the deserialized configuration object.abstract java.lang.Class<T>
getConfigType()
Gets the configuration class type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.smithy.build.SmithyBuildPlugin
getName, isSerial, requiresValidModel
-
-
-
-
Method Detail
-
getConfigType
public abstract java.lang.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 staticfromNode
method, it will be invoked and is expected to deserialize the Node. If the POJO has a public staticbuilder
method, it will be invoked, setters will be called on the builder POJO, and finally the result of calling thebuild
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 interfaceSmithyBuildPlugin
- 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.
-
-