Class GeneratorTemplateContentLocator
- java.lang.Object
-
- org.openapitools.codegen.templating.GeneratorTemplateContentLocator
-
- All Implemented Interfaces:
TemplatePathLocator
public class GeneratorTemplateContentLocator extends Object implements TemplatePathLocator
Locates templates according toCodegenConfig
settings.
-
-
Constructor Summary
Constructors Constructor Description GeneratorTemplateContentLocator(CodegenConfig codegenConfig)
Constructs a new instance ofGeneratorTemplateContentLocator
for the providedCodegenConfig
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
embeddedTemplateExists(String name)
Determines whether an embedded file with the specified name exists.String
getFullTemplatePath(String relativeTemplateFile)
Get the template file path with template dir prepended, and use the library template if exists.
-
-
-
Constructor Detail
-
GeneratorTemplateContentLocator
public GeneratorTemplateContentLocator(CodegenConfig codegenConfig)
Constructs a new instance ofGeneratorTemplateContentLocator
for the providedCodegenConfig
- Parameters:
codegenConfig
- A generator's configuration used for determining template file location.
-
-
Method Detail
-
embeddedTemplateExists
public boolean embeddedTemplateExists(String name)
Determines whether an embedded file with the specified name exists.- Parameters:
name
- The name of the file (i.e. relative to resource root)- Returns:
- true if file is an embedded resource, false if it does not exist
-
getFullTemplatePath
public String getFullTemplatePath(String relativeTemplateFile)
Get the template file path with template dir prepended, and use the library template if exists. Precedence: 1) (template dir)/libraries/(library) 2) (template dir) 3) (embedded template dir)/libraries/(library) 4) (embedded template dir) Where "template dir" may be user defined and "embedded template dir" are the built-in templates for the given generator.- Specified by:
getFullTemplatePath
in interfaceTemplatePathLocator
- Parameters:
relativeTemplateFile
- Template file- Returns:
- String Full template file path
-
-