Class BulletedSection<T>
java.lang.Object
io.spring.initializr.generator.io.text.BulletedSection<T>
- Type Parameters:
T
- the type of the item in the bullets
- All Implemented Interfaces:
Section
Section
for list of items using a TemplateRenderer
. The template is
rendered with the registered items set in the model with a configurable item name.- Author:
- Madhura Bhave
-
Constructor Summary
ConstructorsConstructorDescriptionBulletedSection
(TemplateRenderer templateRenderer, String templateName) Create a new instance adding items in the model with theitems
key.BulletedSection
(TemplateRenderer templateRenderer, String templateName, String itemName) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionAdd an item to the list.getItems()
Return an immutable list of the registered items.boolean
isEmpty()
Specify whether this section is empty.void
write
(PrintWriter writer) Write the content of the section to the specifiedwriter
.
-
Constructor Details
-
BulletedSection
Create a new instance adding items in the model with theitems
key.- Parameters:
templateRenderer
- the template renderer to usetemplateName
- the name of the template
-
BulletedSection
Create a new instance.- Parameters:
templateRenderer
- the template renderer to usetemplateName
- the name of the templateitemName
- the key of the items in the model
-
-
Method Details
-
addItem
Add an item to the list.- Parameters:
item
- the item to add- Returns:
- this for method chaining
-
isEmpty
public boolean isEmpty()Specify whether this section is empty.- Returns:
true
if no item is registered
-
getItems
Return an immutable list of the registered items.- Returns:
- the registered items
-
write
Description copied from interface:Section
Write the content of the section to the specifiedwriter
.- Specified by:
write
in interfaceSection
- Parameters:
writer
- the writer to use- Throws:
IOException
- if writing the section failed
-