Package com.gurock.smartinspect.contexts
Class ListViewerContext
- java.lang.Object
-
- com.gurock.smartinspect.contexts.ViewerContext
-
- com.gurock.smartinspect.contexts.TextContext
-
- com.gurock.smartinspect.contexts.ListViewerContext
-
- Direct Known Subclasses:
TableViewerContext,ValueListViewerContext
public class ListViewerContext extends TextContext
Represents the list viewer in the Console which can display simple lists of text data.The list viewer in the Console interprets the data of a Log Entry as a list. Every line in the text data is interpreted as one item of the list. This class takes care of the necessary formatting and escaping required by the corresponding list viewer in the Console.
You can use the ListViewerContext class for creating custom log methods around logCustomContext for sending custom data organized as simple lists.
This class is not guaranteed to be threadsafe.
-
-
Constructor Summary
Constructors Modifier Constructor Description ListViewerContext()Overloaded.protectedListViewerContext(ViewerId vi)Overloaded.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringescapeLine(String line)Overridden.protected static StringescapeLine(String line, String toEscape)Escapes a line.-
Methods inherited from class com.gurock.smartinspect.contexts.TextContext
appendLine, appendText, close, getViewerData, loadFromFile, loadFromReader, loadFromStream, loadFromText, resetData
-
Methods inherited from class com.gurock.smartinspect.contexts.ViewerContext
getViewerId
-
-
-
-
Constructor Detail
-
ListViewerContext
public ListViewerContext()
Overloaded. Creates and initializes a ListViewerContext instance.
-
ListViewerContext
protected ListViewerContext(ViewerId vi)
Overloaded. Creates and initializes a ListViewerContext instance using a different viewer ID. This constructor is intended for derived classes, such as the ValueListViewerContext class, which extend the capabilities of this class and use a different viewer ID.- Parameters:
vi- The viewer ID to use.
-
-
Method Detail
-
escapeLine
protected String escapeLine(String line)
Overridden. Escapes a line. This method ensures that the escaped line does not contain any newline characters, such as the carriage return or linefeed characters.- Overrides:
escapeLinein classTextContext- Parameters:
line- The line to escape.- Returns:
- The escaped line.
-
escapeLine
protected static String escapeLine(String line, String toEscape)
Escapes a line. This method ensures that the escaped line does not contain characters listed in the toEscape parameter plus any newline characters, such as the carriage return or linefeed characters.- Parameters:
line- The line to escape.toEscape- A set of characters which should be escaped in addition to the newline characters. Can be null or empty.- Returns:
- The escaped line.
-
-