public class JsonLocation
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
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(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 |
---|---|
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() |
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".
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
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"