public class ContentReference extends Object implements Serializable
JsonLocation
)
objections, most commonly to be printed out as part of Exception
messages.Modifier and Type | Field and Description |
---|---|
protected boolean |
_isContentTextual
Marker flag to indicate whether included content is textual or not:
this is taken to mean, by default, that a snippet of content may be
displayed for exception messages.
|
protected int |
_length
For static content, indicates length of content in
the static array.
|
protected int |
_maxRawContentLength
max raw content to return as configured
|
protected int |
_offset
For static content, indicates offset from the beginning
of static array.
|
protected Object |
_rawContent
Reference to the actual underlying content.
|
static int |
DEFAULT_MAX_CONTENT_SNIPPET
Deprecated.
Since 2.16.
ErrorReportConfiguration.DEFAULT_MAX_RAW_CONTENT_LENGTH will be used instead. |
protected static ContentReference |
REDACTED_CONTENT
As content will be redacted by default in Jackson 2.16 and later,
we'll use a new marker reference for slightly different description
from "unknown", to indicate explicit removal of source/content reference
(as opposed to it missing from not being available or so)
|
protected static ContentReference |
UNKNOWN_CONTENT
Constant that may be used when source/target content is not known
(or not exposed).
|
Modifier | Constructor and Description |
---|---|
protected |
ContentReference(boolean isContentTextual,
Object rawContent)
Deprecated.
Since 2.16. Use
ContentReference(boolean, Object, ErrorReportConfiguration) instead. |
protected |
ContentReference(boolean isContentTextual,
Object rawContent,
ErrorReportConfiguration errorReportConfiguration) |
protected |
ContentReference(boolean isContentTextual,
Object rawContent,
int offset,
int length)
Deprecated.
Since 2.16. Use
ContentReference(boolean, Object, int, int, ErrorReportConfiguration) instead. |
protected |
ContentReference(boolean isContentTextual,
Object rawContent,
int offset,
int length,
ErrorReportConfiguration errorReportConfiguration) |
Modifier and Type | Method and Description |
---|---|
protected int |
_append(StringBuilder sb,
String content) |
protected boolean |
_appendEscaped(StringBuilder sb,
int ctrlChar) |
protected String |
_truncate(byte[] b,
int[] offsets,
int maxSnippetLen) |
protected String |
_truncate(char[] cs,
int[] offsets,
int maxSnippetLen) |
protected String |
_truncate(CharSequence cs,
int[] offsets,
int maxSnippetLen) |
protected void |
_truncateOffsets(int[] offsets,
int actualLength) |
StringBuilder |
appendSourceDescription(StringBuilder sb)
Method for appending a "source description" when content represented
by this reference is read.
|
String |
buildSourceDescription()
Method for constructing a "source description" when content represented
by this reference is read.
|
static ContentReference |
construct(boolean isContentTextual,
Object rawContent)
Deprecated.
Since 2.16. Use
construct(boolean, Object, ErrorReportConfiguration) instead. |
static ContentReference |
construct(boolean isContentTextual,
Object rawContent,
ErrorReportConfiguration errorReportConfiguration) |
static ContentReference |
construct(boolean isContentTextual,
Object rawContent,
int offset,
int length)
Deprecated.
Since 2.16. Use
construct(boolean, Object, int, int, ErrorReportConfiguration) instead. |
static ContentReference |
construct(boolean isContentTextual,
Object rawContent,
int offset,
int length,
ErrorReportConfiguration errorReportConfiguration) |
int |
contentLength() |
int |
contentOffset() |
boolean |
equals(Object other) |
Object |
getRawContent() |
int |
hashCode() |
boolean |
hasTextualContent() |
protected int |
maxRawContentLength()
Internal accessor, overridable, used for checking length (in units in
which content is counted, either bytes or chars) to use for truncation
(so as not to include full content for humongous sources or targets)
|
static ContentReference |
rawReference(boolean isContentTextual,
Object rawContent)
Factory method for legacy code to use for constructing instances to
content about which only minimal amount of information is available.
|
static ContentReference |
rawReference(Object rawContent) |
protected Object |
readResolve() |
static ContentReference |
redacted()
Accessor for getting a placeholder when actual content
is not to be exposed: different from
unknown() where
content is not available to be referenced. |
static ContentReference |
unknown()
Accessor for getting a placeholder for cases where actual content
is not known (or is not something that system wants to expose).
|
protected static final ContentReference UNKNOWN_CONTENT
NOTE: As of 2.13 assume to contain Binary content, meaning that no content snippets will be included.
protected static final ContentReference REDACTED_CONTENT
@Deprecated public static final int DEFAULT_MAX_CONTENT_SNIPPET
ErrorReportConfiguration.DEFAULT_MAX_RAW_CONTENT_LENGTH
will be used instead.protected final transient Object _rawContent
protected final int _offset
-1
if not in use.protected final int _length
-1
if not in use.protected final boolean _isContentTextual
protected final int _maxRawContentLength
@Deprecated protected ContentReference(boolean isContentTextual, Object rawContent)
ContentReference(boolean, Object, ErrorReportConfiguration)
instead.isContentTextual
- Whether content is textual (not binary)rawContent
- Contents being referenced@Deprecated protected ContentReference(boolean isContentTextual, Object rawContent, int offset, int length)
ContentReference(boolean, Object, int, int, ErrorReportConfiguration)
instead.isContentTextual
- Whether content is textual (not binary)rawContent
- Contents being referencedoffset
- Offset of content within rawContent
length
- Length of content within rawContent
protected ContentReference(boolean isContentTextual, Object rawContent, ErrorReportConfiguration errorReportConfiguration)
protected ContentReference(boolean isContentTextual, Object rawContent, int offset, int length, ErrorReportConfiguration errorReportConfiguration)
public static ContentReference unknown()
null
referencepublic static ContentReference redacted()
unknown()
where
content is not available to be referenced.@Deprecated public static ContentReference construct(boolean isContentTextual, Object rawContent)
construct(boolean, Object, ErrorReportConfiguration)
instead.@Deprecated public static ContentReference construct(boolean isContentTextual, Object rawContent, int offset, int length)
construct(boolean, Object, int, int, ErrorReportConfiguration)
instead.public static ContentReference construct(boolean isContentTextual, Object rawContent, int offset, int length, ErrorReportConfiguration errorReportConfiguration)
public static ContentReference construct(boolean isContentTextual, Object rawContent, ErrorReportConfiguration errorReportConfiguration)
public static ContentReference rawReference(boolean isContentTextual, Object rawContent)
isContentTextual
- Is raw content assumed to have textual content
(true
) or binary (false
)rawContent
- Underlying raw content accesspublic static ContentReference rawReference(Object rawContent)
protected Object readResolve()
public boolean hasTextualContent()
public Object getRawContent()
public int contentOffset()
public int contentLength()
protected int maxRawContentLength()
ErrorReportConfiguration.getMaxRawContentLength()
public String buildSourceDescription()
public StringBuilder appendSourceDescription(StringBuilder sb)
sb
- StringBuilder to append description toprotected String _truncate(CharSequence cs, int[] offsets, int maxSnippetLen)
protected String _truncate(char[] cs, int[] offsets, int maxSnippetLen)
protected String _truncate(byte[] b, int[] offsets, int maxSnippetLen)
protected void _truncateOffsets(int[] offsets, int actualLength)
protected int _append(StringBuilder sb, String content)
protected boolean _appendEscaped(StringBuilder sb, int ctrlChar)
Copyright © 2008–2024 FasterXML. All rights reserved.