Class CodeBlock.Builder
java.lang.Object
io.spring.initializr.generator.language.CodeBlock.Builder
- Enclosing class:
- CodeBlock
-
Method Summary
Modifier and TypeMethodDescriptionAdd the specifiedCodeBlock, without any extra line or statement separator.Add more code using the specified code and optional arguments.addStatement(CodeBlock codeBlock) Add the specifiedCodeBlockas a statement.addStatement(String format, Object... args) Add more code using the specified code and optional arguments and indicate that this statement is finished.build()Build aCodeBlockwith the current state of this builder.
-
Method Details
-
add
Add the specifiedCodeBlock, without any extra line or statement separator.- Parameters:
codeBlock- the code to add- Returns:
- this for method chaining
-
add
Add more code using the specified code and optional arguments.- Parameters:
format- the codeargs- the arguments, if any- Returns:
- this for method chaining
-
addStatement
Add the specifiedCodeBlockas a statement.- Parameters:
codeBlock- the code to add- Returns:
- this for method chaining
-
addStatement
Add more code using the specified code and optional arguments and indicate that this statement is finished.- Parameters:
format- the codeargs- the arguments, if any- Returns:
- this for method chaining
-
build
Build aCodeBlockwith the current state of this builder.- Returns:
- a
CodeBlock
-