Package org.apache.tools.ant
Class Location
- java.lang.Object
- 
- org.apache.tools.ant.Location
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class Location extends java.lang.Object implements java.io.SerializableStores 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:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static LocationUNKNOWN_LOCATIONLocation to use when one is needed but no information is available
 - 
Constructor SummaryConstructors 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.
 - 
Method SummaryModifier and Type Method Description booleanequals(java.lang.Object other)Equality operation.intgetColumnNumber()java.lang.StringgetFileName()intgetLineNumber()inthashCode()Hash operation.java.lang.StringtoString()Returns the file name, line number, a colon and a trailing space.
 
- 
- 
- 
Field Detail- 
UNKNOWN_LOCATIONpublic static final Location UNKNOWN_LOCATION Location to use when one is needed but no information is available
 
- 
 - 
Constructor Detail- 
Locationpublic Location(java.lang.String fileName) Creates a location consisting of a file name but no line number or column number.- Parameters:
- fileName- The name of the file. May be- null, in which case the location is equivalent to- UNKNOWN_LOCATION.
 
 - 
Locationpublic Location(org.xml.sax.Locator loc) Creates a location from the SAX locator using the system ID as the filename.- Parameters:
- loc- Must not be- null.
- Since:
- Ant 1.6
 
 - 
Locationpublic Location(java.lang.String fileName, int lineNumber, int columnNumber)Creates a location consisting of a file name, line number and column number.- Parameters:
- 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.
 
 
- 
 - 
Method Detail- 
getFileNamepublic java.lang.String getFileName() - Returns:
- the filename portion of the location
- Since:
- Ant 1.6
 
 - 
getLineNumberpublic int getLineNumber() - Returns:
- the line number
- Since:
- Ant 1.6
 
 - 
getColumnNumberpublic int getColumnNumber() - Returns:
- the column number
- Since:
- Ant 1.7
 
 - 
toStringpublic java.lang.String 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.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- a String of the form "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.
 
 - 
equalspublic boolean equals(java.lang.Object other) Equality operation.- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- other- the object to compare to.
- Returns:
- true if the other object contains the same information as this object.
- Since:
- Ant 1.6.3
 
 - 
hashCodepublic int hashCode() Hash operation.- Overrides:
- hashCodein class- java.lang.Object
- Returns:
- a hash code value for this location.
- Since:
- Ant 1.6.3
 
 
- 
 
-