Location (Apache Ant API)
Keywords: org.apache.tools.ant.Location class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant
Class Location

    java.lang.Object
      org.apache.tools.ant.Location

public class Location
extends java.lang.Object

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.

Field Summary
`static Location` | `UNKNOWN_LOCATION` Location to use when one is needed but no information is available

Constructor Summary
`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.

Method Summary
`java.lang.String` | `toString()` Returns the file name, line number, a colon and a trailing space.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### UNKNOWN_LOCATION

    public static final Location UNKNOWN_LOCATION

  Location to use when one is needed but no information is available

Constructor Detail

### Location

    public 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`.

### Location

    public 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

### toString

    public 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.

  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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.