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", whereNis a number.
List items can be indented.- Author:
- Damien Carbonne
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStructuredDescription.Builder<B extends StructuredDescription.Builder<B>>StructuredDescriptionbuilder.
-
Constructor Summary
Constructors Modifier Constructor Description protectedStructuredDescription(StructuredDescription.Builder<?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StructuredDescription.Builder<?>builder()StringgetHeader()StringgetSectionContent(String section)List<String>getSectionItems(String section)List<String>getSections()StringgetText()booleanhasSection(String section)StringtoString()
-
-
-
Constructor Detail
-
StructuredDescription
protected StructuredDescription(StructuredDescription.Builder<?> builder)
-
-
Method Detail
-
getText
public String getText()
- Returns:
- The text of the description.
-
getHeader
public String getHeader()
- Returns:
- The description header (text before first section).
-
hasSection
public boolean hasSection(String section)
- Parameters:
section- The section name.- Returns:
trueif a section namedsectionexists 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.
-
builder
public static StructuredDescription.Builder<?> builder()
-
-