Package cdc.issues

Class StructuredDescription

java.lang.Object
cdc.issues.StructuredDescription
Direct Known Subclasses:
RuleDescription

public class StructuredDescription extends Object
Class used to build simple structured descriptions.

It can have an optional header, followed by optional sections.
Each section has a title and a content.
A section is marked as "# name" where name is the section name (title).
Header and sections contents can be structured as lists of ordered or unordered items.
Unordered list items are generated as "- item".
Ordered list items are generated as "N) item", where N is a number.
List items can be indented.

Author:
Damien Carbonne
  • Constructor Details

  • Method Details

    • getText

      public String getText()
      Returns:
      The text of the description.
    • getHeader

      public String getHeader()
      Returns:
      The description header (text before first section).
    • getSections

      public List<String> getSections()
      Returns:
      A list of declared sections.
    • hasSection

      public boolean hasSection(String section)
      Parameters:
      section - The section name.
      Returns:
      true if a section named section exists in this description.
    • getSectionContent

      public String getSectionContent(String section)
      Parameters:
      section - The section name.
      Returns:
      The content of the section named section, or an empty string if no such section exists.
    • getSectionItems

      public List<String> getSectionItems(String section)
      Parameters:
      section - The section name.
      Returns:
      A list of items declared in section named section. The returned list is empty if no such section exists.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static StructuredDescription.Builder<?> builder()