public class JsonLocation
extends java.lang.Object
implements java.io.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 |
---|---|
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(java.lang.Object srcRef,
long totalChars,
int lineNr,
int columnNr)
Deprecated.
|
JsonLocation(java.lang.Object srcRef,
long totalBytes,
long totalChars,
int lineNr,
int columnNr)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
java.lang.StringBuilder |
appendOffsetDescription(java.lang.StringBuilder sb) |
ContentReference |
contentReference()
Accessor for information about the original input source content is being
read from.
|
boolean |
equals(java.lang.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.
|
java.lang.Object |
getSourceRef()
Deprecated.
Since 2.13 Use
contentReference() instead |
int |
hashCode() |
java.lang.String |
offsetDescription()
Accessor for a brief summary of Location offsets (line number, column position,
or byte offset, if available).
|
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() |
@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".
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(java.lang.Object srcRef, long totalChars, int lineNr, int columnNr)
@Deprecated public JsonLocation(java.lang.Object srcRef, long totalBytes, long totalChars, int lineNr, int columnNr)
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 java.lang.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 java.lang.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 java.lang.String offsetDescription()
public java.lang.StringBuilder appendOffsetDescription(java.lang.StringBuilder sb)
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
Copyright © 2010 - 2023 Adobe. All Rights Reserved