Package org.apache.struts2.util.location
Class LocationImpl
java.lang.Object
org.apache.struts2.util.location.LocationImpl
- All Implemented Interfaces:
- Serializable,- Location
A simple immutable and serializable implementation of 
Location.- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionLocationImpl(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.LocationImpl(String description, Location location) Create a location from an existing one, but with a different descriptionLocationImpl(Location location) Copy constructor.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanstatic LocationImplObtain aLocationImplfrom aLocation.intGet the column number of this locationGet the description of this locationintGet the line number of this locationgetSnippet(int padding) Gets a source code snippet with the default paddinggetURI()Get the URI of this locationinthashCode()toString()
- 
Constructor Details- 
LocationImplBuild a location for a given URI, with unknown line and column numbers.- Parameters:
- description- description for location
- uri- the resource URI
 
- 
LocationImplBuild a location for a given URI and line and column numbers.- Parameters:
- description- description for location
- uri- the resource URI
- line- the line number (starts at 1)
- column- the column number (starts at 1)
 
- 
LocationImplCopy constructor.- Parameters:
- location- the location to be copied
 
- 
LocationImplCreate a location from an existing one, but with a different description- Parameters:
- description- description for location
- location- location object
 
 
- 
- 
Method Details- 
getObtain aLocationImplfrom aLocation. Iflocationis already aLocationImpl, 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
 
- 
getDescriptionGet the description of this location- Specified by:
- getDescriptionin interface- Location
- Returns:
- the description (can be null)
 
- 
getURIGet the URI of this location
- 
getLineNumberpublic int getLineNumber()Get the line number of this location- Specified by:
- getLineNumberin interface- Location
- Returns:
- the line number (-1if unknown)
 
- 
getColumnNumberpublic int getColumnNumber()Get the column number of this location- Specified by:
- getColumnNumberin interface- Location
- Returns:
- the column number (-1if unknown)
 
- 
getSnippetDescription copied from interface:LocationGets a source code snippet with the default padding- Specified by:
- getSnippetin interface- Location
- Parameters:
- padding- The amount of lines before and after the error to include
- Returns:
- a source code snippet with the default padding
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-