java.io.Serializable
public class Location
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field | Description |
---|---|---|
static Location |
UNKNOWN_LOCATION |
Location to use when one is needed but no information is available
|
Constructor | Description |
---|---|
Location(java.lang.String fileName) |
Creates a location consisting of a file name but no line number or
column number.
|
Location(java.lang.String fileName,
int lineNumber,
int columnNumber) |
Creates a location consisting of a file name, line number and
column number.
|
Location(org.xml.sax.Locator loc) |
Creates a location from the SAX locator using the system ID as
the filename.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object other) |
Equality operation.
|
int |
getColumnNumber() |
|
java.lang.String |
getFileName() |
|
int |
getLineNumber() |
|
int |
hashCode() |
Hash operation.
|
java.lang.String |
toString() |
Returns the file name, line number, a colon and a trailing space.
|
public static final Location UNKNOWN_LOCATION
public Location(java.lang.String fileName)
fileName
- The name of the file. May be null
,
in which case the location is equivalent to
UNKNOWN_LOCATION
.public Location(org.xml.sax.Locator loc)
loc
- Must not be null
.public Location(java.lang.String fileName, int lineNumber, int columnNumber)
fileName
- The name of the file. May be null
,
in which case the location is equivalent to
UNKNOWN_LOCATION
.lineNumber
- Line number within the file. Use 0 for unknown
positions within a file.columnNumber
- Column number within the line.public java.lang.String getFileName()
public int getLineNumber()
public int getColumnNumber()
public java.lang.String toString()
toString
in class java.lang.Object
"fileName:lineNumber: "
if both file name and line number are known,
"fileName: "
if only the file name is known,
and the empty string for unknown locations.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the object to compare to.public int hashCode()
hashCode
in class java.lang.Object