public class JsonLocation extends Object implements Serializable
NOTE: users should be careful if using equals(java.lang.Object)
implementation as
it may or may not compare underlying "content reference" for equality.
Instead if would make sense to explicitly implementing equality checks
using specific criteria caller desires.
Modifier and Type | Field and Description |
---|---|
protected int |
_columnNr |
protected ContentReference |
_contentReference
Reference to input source; never null (but may be that of
ContentReference.unknown() ). |
protected int |
_lineNr |
protected String |
_sourceDescription
Lazily constructed description for source; constructed if and
when
sourceDescription() is called, retained. |
protected long |
_totalBytes |
protected long |
_totalChars |
static int |
MAX_CONTENT_SNIPPET
Deprecated.
Since 2.13 use
ContentReference.DEFAULT_MAX_CONTENT_SNIPPET instead |
static JsonLocation |
NA
Shared immutable "N/A location" that can be returned to indicate
that no location information is available.
|
Constructor and Description |
---|
JsonLocation(ContentReference contentRef,
long totalChars,
int lineNr,
int colNr) |
JsonLocation(ContentReference contentRef,
long totalBytes,
long totalChars,
int lineNr,
int columnNr) |
JsonLocation(Object srcRef,
long totalChars,
int lineNr,
int columnNr)
Deprecated.
|
JsonLocation(Object srcRef,
long totalBytes,
long totalChars,
int lineNr,
int columnNr)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected static ContentReference |
_wrap(Object srcRef) |
StringBuilder |
appendOffsetDescription(StringBuilder sb) |
ContentReference |
contentReference()
Accessor for information about the original input source content is being
read from.
|
boolean |
equals(Object other) |
long |
getByteOffset() |
long |
getCharOffset() |
int |
getColumnNr()
Access for getting column position of this location, if available.
|
int |
getLineNr()
Access for getting line number of this location, if available.
|
Object |
getSourceRef()
Deprecated.
Since 2.13 Use
contentReference() instead |
int |
hashCode() |
String |
offsetDescription()
Accessor for a brief summary of Location offsets (line number, column position,
or byte offset, if available).
|
String |
sourceDescription()
Accessor for getting a textual description of source reference
(Object returned by
getSourceRef() ), as included in
description returned by toString() . |
String |
toString() |
@Deprecated public static final int MAX_CONTENT_SNIPPET
ContentReference.DEFAULT_MAX_CONTENT_SNIPPET
insteadpublic 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
protected final ContentReference _contentReference
ContentReference.unknown()
)._sourceRef
(Object-valued)protected transient String _sourceDescription
sourceDescription()
is called, retained.public JsonLocation(ContentReference contentRef, long totalChars, int lineNr, int colNr)
public JsonLocation(ContentReference contentRef, long totalBytes, long totalChars, int lineNr, int columnNr)
@Deprecated public JsonLocation(Object srcRef, long totalChars, int lineNr, int columnNr)
@Deprecated public JsonLocation(Object srcRef, long totalBytes, long totalChars, int lineNr, int columnNr)
protected static ContentReference _wrap(Object srcRef)
public ContentReference contentReference()
null
but may not contain
useful information.
NOTE: not getter, on purpose, to avoid inlusion if serialized using default Jackson serializer.
getSourceRef
)@Deprecated public Object getSourceRef()
contentReference()
insteadFile
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()
-1
if not.public int getColumnNr()
-1
if not.public long getCharOffset()
-1
if not.public long getByteOffset()
-1
if not.public String sourceDescription()
getSourceRef()
), as included in
description returned by toString()
.
Note: implementation will simply call
ContentReference.buildSourceDescription()
)
NOTE: not added as a "getter" to prevent it from getting serialized.
getSourceRef()
public String offsetDescription()
public StringBuilder appendOffsetDescription(StringBuilder sb)
Copyright © 2008–2023 FasterXML. All rights reserved.