public class ContextTools extends Object
Constructor and Description |
---|
ContextTools() |
Modifier and Type | Method and Description |
---|---|
String |
getContext(int fromPos,
int toPos,
String contents) |
String |
getPlainTextContext(int fromPos,
int toPos,
String contents)
Get a plain text context that uses
^ characters in a new line as a marker of the
given string region. |
void |
setContextSize(int contextSize)
The context size of the error.
|
void |
setErrorMarker(String start,
String end)
Set the string used to mark the beginning and end of an error, e.g.
|
void |
setErrorMarkerEnd(String errorMarkerEnd)
Set the string used to mark the end of an error, e.g.
|
void |
setErrorMarkerStart(String errorMarkerStart)
Set the string used to mark the beginning of an error, e.g.
|
void |
setEscapeHtml(boolean escapeHtml)
Whether HTML special characters should be escaped.
|
public String getPlainTextContext(int fromPos, int toPos, String contents)
^
characters in a new line as a marker of the
given string region. Ignores setEscapeHtml(boolean)
.public void setErrorMarker(String start, String end)
<span class="error">
and </span>
public void setErrorMarkerStart(String errorMarkerStart)
<span class="error">
public void setErrorMarkerEnd(String errorMarkerEnd)
</span>
public void setContextSize(int contextSize)
public void setEscapeHtml(boolean escapeHtml)