...
Code Block |
---|
public final class Plugin { // Existing private final ArtifactId artifactId; private final PluginClass pluginClass; private final PluginProperties properties; // new field /* macros used at this plugin * Examples : * for the field value ${hostname}:${port}/${path}, the set would be[hostname, port, path] * for the field value ${secure(accessKey)}, the set would be [accessKey] * for the field value ${key1:${key2}}, the set would be [key2, key1:${key2}] * for the field value \${u-name}, the set would be empty as macro is escaped * for the field value ${key1\${key2}}, the set would be [key1\${key2}] so the user understands key2 is not a macro and will provide value for the key, "key1${key2}" */ private final Set<String> macros; Plugin(ArtifactId artifactId, PluginClass pluginClass, PluginProperties, @Nullable Set<String> macros) { ... } ... } |
Another Option is instead of returning Set<String> macros, we can return MacroInfo object.
Code Block |
---|
class MacroInfo {
Set<String> properties;
Set<MacroFunction> functions;
}
class MacroFunction {
String functionName;
List<String> arguments;
} |
Though the UI will only be interested in properties, having macro function information will be useful when getting details of a plugin.
Notes:
macros can either be nullable to support backward compatibility
or we need upgrade step to provide empty set for macros when upgrading pipeline.
...