Package org.wildfly.client.config
Class XMLLocation
- java.lang.Object
-
- org.wildfly.client.config.XMLLocation
-
- All Implemented Interfaces:
Comparable<XMLLocation>,Location
public final class XMLLocation extends Object implements Location, Comparable<XMLLocation>
An XML location which is readable by humans and which understands XInclude.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static XMLLocationUNKNOWNAn unknown location.
-
Constructor Summary
Constructors Constructor Description XMLLocation(URI uri)Construct a new instance.XMLLocation(URI uri, int lineNumber, int columnNumber, int characterOffset)Construct a new instance.XMLLocation(URI uri, int lineNumber, int columnNumber, int characterOffset, String publicId, String systemId)Construct a new instance.XMLLocation(XMLLocation includedFrom, URI uri, int lineNumber, int columnNumber, int characterOffset)Construct a new instance.XMLLocation(XMLLocation includedFrom, URI uri, int lineNumber, int columnNumber, int characterOffset, String publicId, String systemId)Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(XMLLocation o)Compare for sort.booleanequals(Object other)Determine whether this object is equal to another.booleanequals(XMLLocation other)Determine whether this object is equal to another.intgetCharacterOffset()Get the absolute character offset of this event.intgetColumnNumber()Get the column number where the corresponding event ends.XMLLocationgetIncludedFrom()Get the location that this location was included from.intgetLineNumber()Get the line number where the corresponding event ends.StringgetPublicId()Get the public ID of the XML.StringgetSystemId()Get the system ID of the XML.URIgetUri()Get the file name.inthashCode()StringtoString()Get the location as a string.static XMLLocationtoXMLLocation(URI uri, Location location)static XMLLocationtoXMLLocation(Location location)static XMLLocationtoXMLLocation(XMLLocation includedFrom, URI uri, Location location)static XMLLocationtoXMLLocation(XMLLocation includedFrom, Location location)
-
-
-
Field Detail
-
UNKNOWN
public static final XMLLocation UNKNOWN
An unknown location.
-
-
Constructor Detail
-
XMLLocation
public XMLLocation(XMLLocation includedFrom, URI uri, int lineNumber, int columnNumber, int characterOffset, String publicId, String systemId)
Construct a new instance.- Parameters:
includedFrom- the source location that this location was included fromuri- the source location (may benullif not known)lineNumber- the line number (may be-1if not known)columnNumber- the column number (may be-1if not known)characterOffset- the character offset (may be-1if not known)publicId- the XML public ID (may benull)systemId- the XML system ID (may benull)
-
XMLLocation
public XMLLocation(URI uri, int lineNumber, int columnNumber, int characterOffset, String publicId, String systemId)
Construct a new instance.- Parameters:
uri- the source location (may benullif not known)lineNumber- the line number (may be-1if not known)columnNumber- the column number (may be-1if not known)characterOffset- the character offset (may be-1if not known)publicId- the XML public ID (may benull)systemId- the XML system ID (may benull)
-
XMLLocation
public XMLLocation(XMLLocation includedFrom, URI uri, int lineNumber, int columnNumber, int characterOffset)
Construct a new instance.- Parameters:
includedFrom- the source location that this location was included fromuri- the source location (may benullif not known)lineNumber- the line number (may be-1if not known)columnNumber- the column number (may be-1if not known)characterOffset- the character offset (may be-1if not known)
-
XMLLocation
public XMLLocation(URI uri, int lineNumber, int columnNumber, int characterOffset)
Construct a new instance.- Parameters:
uri- the source location (may benullif not known)lineNumber- the line number (may be-1if not known)columnNumber- the column number (may be-1if not known)characterOffset- the character offset (may be-1if not known)
-
XMLLocation
public XMLLocation(URI uri)
Construct a new instance.- Parameters:
uri- the file name (may benullif this location does not correspond to a file)
-
-
Method Detail
-
getUri
public URI getUri()
Get the file name. May benullif this location does not correspond to a file.- Returns:
- the file name
-
getLineNumber
public int getLineNumber()
Get the line number where the corresponding event ends. Returns -1 if not known.- Specified by:
getLineNumberin interfaceLocation- Returns:
- the line number where the corresponding event ends
-
getColumnNumber
public int getColumnNumber()
Get the column number where the corresponding event ends. Returns -1 if not known.- Specified by:
getColumnNumberin interfaceLocation- Returns:
- the column number where the corresponding event ends
-
getCharacterOffset
public int getCharacterOffset()
Get the absolute character offset of this event. Returns -1 if not known.- Specified by:
getCharacterOffsetin interfaceLocation- Returns:
- the absolute character offset of this event
-
getPublicId
public String getPublicId()
Get the public ID of the XML. Returnsnullif not known.- Specified by:
getPublicIdin interfaceLocation- Returns:
- the public ID of the XML
-
getSystemId
public String getSystemId()
Get the system ID of the XML. Returnsnullif not known.- Specified by:
getSystemIdin interfaceLocation- Returns:
- the system ID of the XML
-
getIncludedFrom
public XMLLocation getIncludedFrom()
Get the location that this location was included from. Returnsnullif this was the root document.- Returns:
- the location that this location was included from, or
null
-
toXMLLocation
public static XMLLocation toXMLLocation(Location location)
-
toXMLLocation
public static XMLLocation toXMLLocation(URI uri, Location location)
-
toXMLLocation
public static XMLLocation toXMLLocation(XMLLocation includedFrom, Location location)
-
toXMLLocation
public static XMLLocation toXMLLocation(XMLLocation includedFrom, URI uri, Location location)
-
equals
public boolean equals(Object other)
Determine whether this object is equal to another.
-
equals
public boolean equals(XMLLocation other)
Determine whether this object is equal to another.- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
toString
public String toString()
Get the location as a string. The string will be suitable for immediately prefixing an error message.
-
compareTo
public int compareTo(XMLLocation o)
Compare for sort.- Specified by:
compareToin interfaceComparable<XMLLocation>- Parameters:
o- the other location- Returns:
- the sort result (-1, 0, or 1)
-
-