public class LocationImpl extends Object implements Location, Serializable
Location
.Constructor and Description |
---|
LocationImpl(Location location)
Copy constructor.
|
LocationImpl(String description,
Location location)
Create a location from an existing one, but with a different description
|
LocationImpl(String description,
String uri)
Build a location for a given URI, with unknown line and column numbers.
|
LocationImpl(String description,
String uri,
int line,
int column)
Build a location for a given URI and line and column numbers.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static LocationImpl |
get(Location location)
Obtain a
LocationImpl from a Location . |
int |
getColumnNumber()
Get the column number of this location
|
String |
getDescription()
Get the description of this location
|
int |
getLineNumber()
Get the line number of this location
|
List<String> |
getSnippet(int padding)
Gets a source code snippet with the default padding
|
String |
getURI()
Get the URI of this location
|
int |
hashCode() |
String |
toString() |
public LocationImpl(String description, String uri)
description
- description for locationuri
- the resource URIpublic LocationImpl(String description, String uri, int line, int column)
description
- description for locationuri
- the resource URIline
- the line number (starts at 1)column
- the column number (starts at 1)public LocationImpl(Location location)
location
- the location to be copiedpublic static LocationImpl get(Location location)
LocationImpl
from a Location
. If location
is
already a LocationImpl
, it is returned, otherwise it is copied.
This method is useful when an immutable and serializable location is needed, such as in locatable exceptions.
location
- the locationlocation
public String getDescription()
getDescription
in interface Location
null
)public String getURI()
public int getLineNumber()
getLineNumber
in interface Location
-1
if unknown)public int getColumnNumber()
getColumnNumber
in interface Location
-1
if unknown)public List<String> getSnippet(int padding)
Location
getSnippet
in interface Location
padding
- The amount of lines before and after the error to includeCopyright © 2000–2020 Apache Software Foundation. All rights reserved.