Package org.openapitools.codegen
Class DryRunTemplateManager
- java.lang.Object
-
- org.openapitools.codegen.DryRunTemplateManager
-
- All Implemented Interfaces:
TemplateProcessor
public class DryRunTemplateManager extends Object implements TemplateProcessor
Manages templates for a generator "dry run"
-
-
Constructor Summary
Constructors Constructor Description DryRunTemplateManager(TemplateManagerOptions options)Constructs a new instance ofDryRunTemplateManagerfor the provided options
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DryRunTemplateManagerenableTemplateDataCapturing()Enable capturing of data being passed to the files as they are being written.
Call this method before callingGenerator.generate().voiderror(Path path, String context)Map<String,Object>getCapturedTemplateData(Path generatedFile)Retrieve the captured template data for a specific file.Map<String,org.openapitools.codegen.DryRunStatus>getDryRunStatusMap()Gets the full status of this dry run.voidignore(Path path, String context)voidskip(Path path, String context)Filewrite(Map<String,Object> data, String template, File target)Writes data to a compiled templateFilewriteToFile(String filename, byte[] contents)
-
-
-
Constructor Detail
-
DryRunTemplateManager
public DryRunTemplateManager(TemplateManagerOptions options)
Constructs a new instance ofDryRunTemplateManagerfor the provided options- Parameters:
options- Options pertaining to templates (reads and writes)
-
-
Method Detail
-
getDryRunStatusMap
public Map<String,org.openapitools.codegen.DryRunStatus> getDryRunStatusMap()
Gets the full status of this dry run.- Returns:
- An immutable copy of the dry run status.
-
write
public File write(Map<String,Object> data, String template, File target) throws IOException
Writes data to a compiled template- Specified by:
writein interfaceTemplateProcessor- Parameters:
data- Input datatemplate- Input template locationtarget- The targeted file output location- Returns:
- The actual file
- Throws:
IOException
-
writeToFile
public File writeToFile(String filename, byte[] contents) throws IOException
- Specified by:
writeToFilein interfaceTemplateProcessor- Throws:
IOException
-
ignore
public void ignore(Path path, String context)
- Specified by:
ignorein interfaceTemplateProcessor
-
skip
public void skip(Path path, String context)
- Specified by:
skipin interfaceTemplateProcessor
-
error
public void error(Path path, String context)
- Specified by:
errorin interfaceTemplateProcessor
-
enableTemplateDataCapturing
public DryRunTemplateManager enableTemplateDataCapturing()
Enable capturing of data being passed to the files as they are being written.
Call this method before callingGenerator.generate().
-
getCapturedTemplateData
public Map<String,Object> getCapturedTemplateData(Path generatedFile)
Retrieve the captured template data for a specific file. Capturing must have been enabled viaenableTemplateDataCapturing()prior to generation.
Note: Not all files have template data (e.g. Metadata files) – in such case an empty map is returned.- Parameters:
generatedFile- An absolute path to the generated file- Returns:
- Typically one of the *Map types found in
org.openapitools.codegen.model
-
-