Class IndentedLambda
- java.lang.Object
-
- org.openapitools.codegen.templating.mustache.IndentedLambda
-
- All Implemented Interfaces:
com.samskivert.mustache.Mustache.Lambda
public class IndentedLambda extends Object implements com.samskivert.mustache.Mustache.Lambda
This naively prepends indention to all lines of a fragment.Generator authors may add helpers for explicitly adding prefixed spaces which fragments won't be aware of.
Register:
additionalProperties.put("indent4", new IndentedLambda(4)); additionalProperties.put("indent8", new IndentedLambda(8));
Use:
{{#indent4}}{{>template}}{{/indent4}} {{#indent8}}{{>other_template}}{{/indent8}}
-
-
Constructor Summary
Constructors Constructor Description IndentedLambda()
Constructs a new instance ofIndentedLambda
, with an indent count of 4 spacesIndentedLambda(int prefixSpaceCount, String indentionCharacter, boolean indentFirstLine, boolean skipEmptyLines)
Constructs a new instance ofIndentedLambda
, with customized indent count and intention characterIndentedLambda(int prefixSpaceCount, String indentionCharacter, String prefix, boolean indentFirstLine, boolean skipEmptyLines)
Constructs a new instance ofIndentedLambda
, with customized indent count and intention character
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(com.samskivert.mustache.Template.Fragment fragment, Writer writer)
-
-
-
Constructor Detail
-
IndentedLambda
public IndentedLambda()
Constructs a new instance ofIndentedLambda
, with an indent count of 4 spaces
-
IndentedLambda
public IndentedLambda(int prefixSpaceCount, String indentionCharacter, boolean indentFirstLine, boolean skipEmptyLines)
Constructs a new instance ofIndentedLambda
, with customized indent count and intention character- Parameters:
prefixSpaceCount
- The number of indented characters to apply as a prefix to a fragment.indentionCharacter
- String representation of the character used in the indent (e.g. " ", "\t", ".").indentFirstLine
- Whether to indent the first line or not. Usually this is handled by the template already.
-
IndentedLambda
public IndentedLambda(int prefixSpaceCount, String indentionCharacter, String prefix, boolean indentFirstLine, boolean skipEmptyLines)
Constructs a new instance ofIndentedLambda
, with customized indent count and intention character- Parameters:
prefixSpaceCount
- The number of indented characters to apply as a prefix to a fragment.indentionCharacter
- String representation of the character used in the indent (e.g. " ", "\t", ".").prefix
- An optional prefix to prepend before the line (useful for multi-line comments).indentFirstLine
- Whether to indent the first line or not. Usually this is handled by the template already.
-
-
Method Detail
-
execute
public void execute(com.samskivert.mustache.Template.Fragment fragment, Writer writer) throws IOException
- Specified by:
execute
in interfacecom.samskivert.mustache.Mustache.Lambda
- Throws:
IOException
-
-