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

## com.opensymphony.xwork2.util.location
Class LocationImpl

    java.lang.Object
      com.opensymphony.xwork2.util.location.LocationImpl

All Implemented Interfaces:
  Location, Serializable

    public class LocationImpl

extends Object
implements Location, Serializable

A simple immutable and serializable implementation of `Location`.

See Also:
  Serialized Form

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

Method Summary
`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()`

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

Constructor Detail

### LocationImpl

    public LocationImpl(String description,
                        String uri)

  Build a location for a given URI, with unknown line and column numbers.

  Parameters:
    `uri` - the resource URI

### LocationImpl

    public LocationImpl(String description,
                        String uri,
                        int line,
                        int column)

  Build a location for a given URI and line and column numbers.

  Parameters:
    `uri` - the resource URI
    `line` - the line number (starts at 1)
    `column` - the column number (starts at 1)

### LocationImpl

    public LocationImpl(Location location)

  Copy constructor.

  Parameters:
    `location` - the location to be copied

### LocationImpl

    public LocationImpl(String description,
                        Location location)

  Create a location from an existing one, but with a different description

Method Detail

### get

    public static LocationImpl get(Location location)

  Obtain a `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.

  Parameters:
    `location` - the location
  Returns:
    an immutable and serializable version of `location`

### getDescription

    public String getDescription()

  Get the description of this location

  Specified by:
    `getDescription` in interface `Location`
  Returns:
    the description (can be `null`)

### getURI

    public String getURI()

  Get the URI of this location

  Specified by:
    `getURI` in interface `Location`
  Returns:
    the URI (`null` if unknown).

### getLineNumber

    public int getLineNumber()

  Get the line number of this location

  Specified by:
    `getLineNumber` in interface `Location`
  Returns:
    the line number (`-1` if unknown)

### getColumnNumber

    public int getColumnNumber()

  Get the column number of this location

  Specified by:
    `getColumnNumber` in interface `Location`
  Returns:
    the column number (`-1` if unknown)

### getSnippet

    public List<String> getSnippet(int padding)

  Gets a source code snippet with the default padding

  Specified by:
    `getSnippet` in interface `Location`
  Parameters:
    `padding` - The amount of lines before and after the error to include
  Returns:
    A list of source lines

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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

Copyright © 2000–2018 Apache Software Foundation. All rights reserved.