public class JsonLocation extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
_columnNr |
protected int |
_lineNr |
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.
|
Constructor and Description |
---|
JsonLocation(Object srcRef,
long totalChars,
int lineNr,
int colNr) |
JsonLocation(Object sourceRef,
long totalBytes,
long totalChars,
int lineNr,
int columnNr) |
Modifier and Type | Method and Description |
---|---|
protected StringBuilder |
_appendSourceDesc(StringBuilder sb) |
boolean |
equals(Object other) |
long |
getByteOffset() |
long |
getCharOffset() |
int |
getColumnNr() |
int |
getLineNr() |
Object |
getSourceRef()
Reference to the original resource being read, if one available.
|
int |
hashCode() |
String |
sourceDescription()
Accessor for getting a textual description of source reference
(Object returned by
getSourceRef() ), as included in
description returned by toString() . |
String |
toString() |
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
public JsonLocation(Object srcRef, long totalChars, int lineNr, int colNr)
public JsonLocation(Object sourceRef, long totalBytes, long totalChars, int lineNr, int columnNr)
public 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.null
if nonepublic int getLineNr()
public int getColumnNr()
public long getCharOffset()
public long getByteOffset()
public String sourceDescription()
getSourceRef()
), as included in
description returned by toString()
.
NOTE: not added as a "getter" to prevent it from getting serialized.
getSourceRef()
protected StringBuilder _appendSourceDesc(StringBuilder sb)
Copyright © 2008–2021 FasterXML. All rights reserved.