Package com.helger.base.location
Class SimpleLocation
java.lang.Object
com.helger.base.location.SimpleLocation
- All Implemented Interfaces:
ILocation
Default implementation of the
ILocation interface. The implementation
is immutable.- Author:
- Philip Helger
-
Field Summary
FieldsFields inherited from interface com.helger.base.location.ILocation
ILLEGAL_NUMBER -
Constructor Summary
ConstructorsConstructorDescriptionSimpleLocation(@Nullable String sResourceID) Constructor with resource ID only.SimpleLocation(@Nullable String sResourceID, int nLineNumber, int nColumnNumber) Constructor with resource ID, line number and column number. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable SimpleLocationCreate aSimpleLocationfrom a StAXLocation.static @Nullable SimpleLocationcreate(@Nullable SourceLocator aLocator) Create aSimpleLocationfrom a JAXPSourceLocator.static @Nullable SimpleLocationCreate aSimpleLocationfrom a SAXLocator.static @Nullable SimpleLocationcreate(@Nullable SAXParseException aLocator) Create aSimpleLocationfrom aSAXParseException.booleanintint@Nullable StringinthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.base.location.ILocation
getAsString, hasColumnNumber, hasLineNumber, hasResourceID, isAnyInformationPresent
-
Field Details
-
NO_LOCATION
A constant representing no location
-
-
Constructor Details
-
SimpleLocation
Constructor with resource ID only.- Parameters:
sResourceID- The resource ID. May benull.
-
SimpleLocation
Constructor with resource ID, line number and column number.- Parameters:
sResourceID- The resource ID. May benull.nLineNumber- The line number. UseILocation.ILLEGAL_NUMBERif not available.nColumnNumber- The column number. UseILocation.ILLEGAL_NUMBERif not available.
-
-
Method Details
-
getResourceID
- Specified by:
getResourceIDin interfaceILocation- Returns:
- The ID of the resource where the error occurred. May be
null.
-
getLineNumber
public int getLineNumber()- Specified by:
getLineNumberin interfaceILocation- Returns:
- The 1-based line number
ILocation.ILLEGAL_NUMBERif no line number is present.
-
getColumnNumber
public int getColumnNumber()- Specified by:
getColumnNumberin interfaceILocation- Returns:
- The 1-based column number
ILocation.ILLEGAL_NUMBERif no column number is present.
-
equals
-
hashCode
public int hashCode() -
toString
-
create
Create aSimpleLocationfrom a SAXLocator.- Parameters:
aLocator- The SAX locator. May benull.- Returns:
nullif the passed locator isnull.
-
create
Create aSimpleLocationfrom a JAXPSourceLocator.- Parameters:
aLocator- The source locator. May benull.- Returns:
nullif the passed locator isnull.
-
create
Create aSimpleLocationfrom aSAXParseException.- Parameters:
aLocator- The SAX parse exception. May benull.- Returns:
nullif the passed exception isnull.
-
create
Create aSimpleLocationfrom a StAXLocation.- Parameters:
aLocator- The StAX location. May benull.- Returns:
nullif the passed location isnull.
-