On this page
[Java] Class SourceText
- org.codehaus.groovy.runtime.powerassert.SourceText
public class SourceText
extends Object
Provides the source text for an assertion statement and translates coordinates in the original source text to coordinates relative to the assertion's (normalized) source text.
Constructor Summary
Constructor and description |
---|
SourceText(AssertStatement stat, SourceUnit sourceUnit, Janitor janitor) Constructs a SourceText by reading the given assertion's source text from the given source unit. |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public int |
getNormalizedColumn(int line, int column) Returns the column in getNormalizedText() corresponding to the given line and column in the original source text. |
|
public String |
getNormalizedText() Returns the assertion's source text after removing line breaks. |
Inherited Methods Summary
Constructor Detail
public SourceText(AssertStatement stat, SourceUnit sourceUnit, Janitor janitor)
Constructs a SourceText by reading the given assertion's source text from the given source unit.
- Parameters:
stat
- an assertion statementsourceUnit
- the source unit containing the assertion statementjanitor
- a Janitor for cleaning up reader sources
Method Detail
public int getNormalizedColumn(int line, int column)
Returns the column in getNormalizedText() corresponding to the given line and column in the original source text. The first character in the normalized text has column 1.
- Parameters:
line
- a line numbercolumn
- a column number
- Returns:
- the column in getNormalizedText() corresponding to the given line and column in the original source text
public String getNormalizedText()
Returns the assertion's source text after removing line breaks.
Limitation: Line comments within the assertion's source text are not handled.
- Returns:
- the assertion's source text after removing line breaks.
© 2003-2022 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/4.0.0/html/gapi/org/codehaus/groovy/runtime/powerassert/SourceText.html