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

public class BulletedSection<T> extends Object implements 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 Details

    • BulletedSection

      public BulletedSection(TemplateRenderer templateRenderer, String templateName)
      Create a new instance adding items in the model with the items key.
      Parameters:
      templateRenderer - the template renderer to use
      templateName - the name of the template
    • BulletedSection

      public BulletedSection(TemplateRenderer templateRenderer, String templateName, String itemName)
      Create a new instance.
      Parameters:
      templateRenderer - the template renderer to use
      templateName - the name of the template
      itemName - the key of the items in the model
  • Method Details

    • addItem

      public BulletedSection<T> addItem(T item)
      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

      public List<T> getItems()
      Return an immutable list of the registered items.
      Returns:
      the registered items
    • write

      public void write(PrintWriter writer) throws IOException
      Description copied from interface: Section
      Write the content of the section to the specified writer.
      Specified by:
      write in interface Section
      Parameters:
      writer - the writer to use
      Throws:
      IOException - if writing the section failed