Package org.apache.tools.ant
Class Location
java.lang.Object
org.apache.tools.ant.Location
- All Implemented Interfaces:
Serializable
Stores the location of a piece of text within a file (file name,
line number and column number). Note that the column number is
currently ignored.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Location
Location to use when one is needed but no information is available -
Constructor Summary
ConstructorDescriptionCreates a location consisting of a file name but no line number or column number.Creates a location consisting of a file name, line number and column number.Creates a location from the SAX locator using the system ID as the filename. -
Method Summary
-
Field Details
-
UNKNOWN_LOCATION
Location to use when one is needed but no information is available
-
-
Constructor Details
-
Location
Creates a location consisting of a file name but no line number or column number.- Parameters:
fileName
- The name of the file. May benull
, in which case the location is equivalent toUNKNOWN_LOCATION
.
-
Location
Creates a location from the SAX locator using the system ID as the filename.- Parameters:
loc
- Must not benull
.- Since:
- Ant 1.6
-
Location
Creates a location consisting of a file name, line number and column number.- Parameters:
fileName
- The name of the file. May benull
, in which case the location is equivalent toUNKNOWN_LOCATION
.lineNumber
- Line number within the file. Use 0 for unknown positions within a file.columnNumber
- Column number within the line.
-
-
Method Details
-
getFileName
- Returns:
- the filename portion of the location
- Since:
- Ant 1.6
-
getLineNumber
public int getLineNumber()- Returns:
- the line number
- Since:
- Ant 1.6
-
getColumnNumber
public int getColumnNumber()- Returns:
- the column number
- Since:
- Ant 1.7
-
toString
Returns the file name, line number, a colon and a trailing space. An error message can be appended easily. For unknown locations, an empty string is returned. -
equals
-
hashCode
-