public class JsonLocation
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
_columnNr |
protected int |
_lineNr |
(package private) java.lang.Object |
_sourceRef
Displayable description for input source: file path, URL.
|
protected long |
_totalBytes |
protected long |
_totalChars |
static int |
MAX_CONTENT_SNIPPET
Include at most first 500 characters/bytes from contents; should be enough
to give context, but not cause unfortunate side effects in things like
logs.
|
static JsonLocation |
NA
Shared immutable "N/A location" that can be returned to indicate
that no location information is available.
|
private static long |
serialVersionUID |
Constructor and Description |
---|
JsonLocation(java.lang.Object srcRef,
long totalChars,
int lineNr,
int colNr) |
JsonLocation(java.lang.Object sourceRef,
long totalBytes,
long totalChars,
int lineNr,
int columnNr) |
Modifier and Type | Method and Description |
---|---|
private int |
_append(java.lang.StringBuilder sb,
java.lang.String content) |
protected java.lang.StringBuilder |
_appendSourceDesc(java.lang.StringBuilder sb) |
boolean |
equals(java.lang.Object other) |
long |
getByteOffset() |
long |
getCharOffset() |
int |
getColumnNr() |
int |
getLineNr() |
java.lang.Object |
getSourceRef()
Reference to the original resource being read, if one available.
|
int |
hashCode() |
java.lang.String |
sourceDescription()
Accessor for getting a textual description of source reference
(Object returned by
getSourceRef() ), as included in
description returned by toString() . |
java.lang.String |
toString() |
private static final long serialVersionUID
public static final int MAX_CONTENT_SNIPPET
public static final JsonLocation NA
NOTE: before 2.9, Location was given as String "N/A"; with 2.9 it was removed so that source should be indicated as "UNKNOWN".
protected final long _totalBytes
protected final long _totalChars
protected final int _lineNr
protected final int _columnNr
final transient java.lang.Object _sourceRef
NOTE: transient
since 2.2 so that Location itself is Serializable.
public JsonLocation(java.lang.Object srcRef, long totalChars, int lineNr, int colNr)
public JsonLocation(java.lang.Object sourceRef, long totalBytes, long totalChars, int lineNr, int columnNr)
public java.lang.Object getSourceRef()
File
instance, this method would return
that File. Will return null if no such reference is available,
for example when InputStream
was used to
construct the parser instance.public int getLineNr()
public int getColumnNr()
public long getCharOffset()
public long getByteOffset()
public java.lang.String sourceDescription()
getSourceRef()
), as included in
description returned by toString()
.
NOTE: not added as a "getter" to prevent it from getting serialized.
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.StringBuilder _appendSourceDesc(java.lang.StringBuilder sb)
private int _append(java.lang.StringBuilder sb, java.lang.String content)