Module com.azure.runtime.host
Class TemplateDescriptorsBuilder
java.lang.Object
com.azure.runtime.host.utils.templates.TemplateDescriptorsBuilder
Facilitates the construction of template descriptors for processing template files. This builder pattern implementation
allows for a fluent and intuitive way to specify multiple templates and their output paths, streamlining the setup
for template processing.
This example demonstrates setting up a builder to process templates located in the "/templates/" directory, with
outputs directed to the "/output/" directory. Each call to
The builder starts with a base template path and an optional output root path. Templates can be added with relative paths, and the builder will concatenate these paths with the base paths provided at the start. This design supports flexible template management, accommodating various project structures and output requirements.
Usage example:
List<TemplateDescriptor> descriptors = TemplateDescriptorsBuilder.begin("/templates/", "/output/")
.with("configTemplate.bicep", "configOutput.bicep")
.with("resourceTemplate.bicep", "resourceOutput.bicep")
.build();
with
adds a new template descriptor to the list.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic TemplateDescriptorsBuilder
Begins the process of specifying template files to be processed, which will be written to the root of the user-specified output directory by default.static TemplateDescriptorsBuilder
Begins the process of specifying template files to be processed.build()
Completes the building process and returns the list of configured template descriptors.Adds a template file to the list of descriptors with the same input and output filename, appended to the previously specified base paths.Adds a template file to the list of descriptors with specified input and output filenames, appended to the previously specified base paths.
-
Method Details
-
begin
Begins the process of specifying template files to be processed, which will be written to the root of the user-specified output directory by default.- Parameters:
templatePath
- The path to the template files, relative to the root of the jar file / the resources directory.- Returns:
- A new TemplateDescriptorsBuilder instance that can then be used to specify the template files to be processed.
-
begin
Begins the process of specifying template files to be processed.- Parameters:
templatePath
- The path to the template files, relative to the root of the jar file / the resources directory.outputRootPath
- The root path where the output files will be written to, relative to the user-specified output directory.- Returns:
- A new TemplateDescriptorsBuilder instance that can then be used to specify the template files to be processed.
-
with
Adds a template file to the list of descriptors with the same input and output filename, appended to the previously specified base paths.- Parameters:
inputFilename
- The filename of the template file, relative to the base template path.- Returns:
- This builder instance to allow for method chaining.
-
with
Adds a template file to the list of descriptors with specified input and output filenames, appended to the previously specified base paths.- Parameters:
inputFilename
- The filename of the template file, relative to the base template path.outputFilename
- The filename for the output file, relative to the base output path.- Returns:
- This builder instance to allow for method chaining.
-
build
Completes the building process and returns the list of configured template descriptors.- Returns:
- A list of
TemplateDescriptor
instances ready for template processing.
-