Interface LocationCapable
-
- All Known Subinterfaces:
EnumConstantSource.Body,FieldSource<O>,JavaAnnotationSource,JavaClassSource,JavaEnumSource,JavaInterfaceSource,JavaPackageInfoSource,JavaSource<T>,MemberSource<O,T>,MethodSource<O>
public interface LocationCapableProvides location information about an element in the source file- Author:
- George Gastaldi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetColumnNumber()Returns the column number corresponding to the given source character position in the original source string.intgetEndPosition()Returns the character index into the original source file indicating where the source fragment corresponding to this element ends.intgetLineNumber()Returns the line number corresponding to the given source character position in the original source string.intgetStartPosition()Returns the character index into the original source file indicating where the source fragment corresponding to this element begins.
-
-
-
Method Detail
-
getStartPosition
int getStartPosition()
Returns the character index into the original source file indicating where the source fragment corresponding to this element begins.- Returns:
- the 0-based character index, or -1 if no source position information is recorded for this element
-
getEndPosition
int getEndPosition()
Returns the character index into the original source file indicating where the source fragment corresponding to this element ends.- Returns:
- the 0-based character index, or -1 if no source position information is recorded for this element
-
getLineNumber
int getLineNumber()
Returns the line number corresponding to the given source character position in the original source string. The initial line of the compilation unit is numbered 1, and each line extends through the last character of the end-of-line delimiter. The very last line extends through the end of the source string and has no line delimiter. For example, the source stringclass A\n{\n}has 3 lines corresponding to inclusive character ranges [0,7], [8,9], and [10,10]. Returns -1 for a character position that does not correspond to any source line, or -2 if no line number information is available for this compilation unit.- Returns:
- the 1-based line number, or
-1if the character position does not correspond to a source line in the original source file or-2if line number information is not known for this compilation unit
-
getColumnNumber
int getColumnNumber()
Returns the column number corresponding to the given source character position in the original source string. Column number are zero-based. Return-1if it is beyond the valid range or-2if the column number information is unknown.- Returns:
- the 0-based column number, or
-1if the character position does not correspond to a source line in the original source file or-2if column number information is unknown for this compilation unit
-
-