
public class SectionEditor extends LineEditor
 Section based editing is a two phase process of parsing the editor's input into a corresponding hierarchy of
 Section instances, followed by rendering the parsed sections to produce the output of the editor. Method
 editLine returns null during parsing and the output of the editor on end of input, rendered by
 calling method getOutput. Parsing is backed by methods getSection and isSectionFinished.
 
LineEditor.edit(java.lang.String)| Constructor and Description | 
|---|
| SectionEditor()Creates a new  SectionEditorinstance. | 
| SectionEditor(LineEditor editor)Creates a new  SectionEditorinstance taking an editor to chain. | 
| SectionEditor(LineEditor editor,
                          String lineSeparator)Creates a new  SectionEditorinstance taking an editor to chain and a string to use for separating lines. | 
| SectionEditor(String lineSeparator)Creates a new  SectionEditorinstance taking a string to use for separating lines. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected String | editLine(String line)Edits a line. | 
| protected void | editSection(Section section)Edits a section. | 
| ExecutorService | getExecutorService()Gets an  ExecutorServiceused to edit sections in parallel. | 
| protected String | getOutput(Section section)Gets the output of the editor. | 
| protected Section | getSection(String line)Parses the given line to mark the start of a new section. | 
| protected boolean | isSectionFinished(String line)Parses the given line to mark the end of a section. | 
| boolean | isSectionPresent(String sectionName)Gets a flag indicating that the input of the editor contained a named section. | 
| void | setExecutorService(ExecutorService value)Sets the  ExecutorServiceto be used to edit sections in parallel. | 
edit, getLineNumber, getLineSeparatorpublic SectionEditor()
SectionEditor instance.public SectionEditor(String lineSeparator)
SectionEditor instance taking a string to use for separating lines.lineSeparator - String to use for separating lines.public SectionEditor(LineEditor editor)
SectionEditor instance taking an editor to chain.editor - The editor to chain.public SectionEditor(LineEditor editor, String lineSeparator)
SectionEditor instance taking an editor to chain and a string to use for separating lines.editor - The editor to chain.lineSeparator - String to use for separating lines.public final ExecutorService getExecutorService()
ExecutorService used to edit sections in parallel.ExecutorService used to edit sections in parallel or null, if no such service has
 been provided by an application.setExecutorService(java.util.concurrent.ExecutorService)public final void setExecutorService(ExecutorService value)
ExecutorService to be used to edit sections in parallel.
 
 The ExecutorService to be used to edit sections in parallel is an optional entity. If no such service is
 provided by an application, no parallelization is performed. Configuration or lifecycle management of the given
 ExecutorService is the responsibility of the application.
 
value - The ExecutorService to be used to edit sections in parallel or null, to disable any
 parallelization.getExecutorService()protected final String editLine(String line) throws IOException
LineEditoreditLine in class LineEditorline - The line to edit or null, indicating the end of input.line with or null, to replace line with nothing.IOException - if editing fails.protected Section getSection(String line) throws IOException
line - The line to parse or null.line or null, if line does not mark the start of a
 section.IOException - if parsing fails.protected boolean isSectionFinished(String line) throws IOException
line - The line to parse or null.true, if line marks the end of a section; false, if line does not mark
 the end of a section.IOException - if parsing fails.protected void editSection(Section section) throws IOException
This method does not change any content by default. Overriding classes may use this method for editing sections prior to rendering.
section - The section to edit.NullPointerException - if section is null.IOException - if editing fails.protected String getOutput(Section section) throws IOException
 This method calls method editSection() for each section of the editor prior to rendering the sections
 to produce the output of the editor.
 
section - The section to start rendering the editor's output with.NullPointerException - if section is null.IOException - if editing or rendering fails.public boolean isSectionPresent(String sectionName)
sectionName - The name of the section to test or null.true, if the input of the editor contained a section with name sectionName;
 false, if the input of the editor did not contain a section with name sectionName.Copyright © 2005–2016 The JOMC Project. All rights reserved.