public static class ReaderWriterModifier.Pair extends ReaderWriterModifier
ReaderWriterModifier.Pair
Modifier and Type | Field and Description |
---|---|
protected ReaderWriterModifier |
_primary |
protected ReaderWriterModifier |
_secondary |
Modifier | Constructor and Description |
---|---|
protected |
Pair(ReaderWriterModifier p,
ReaderWriterModifier s) |
Modifier and Type | Method and Description |
---|---|
ValueReader |
modifyValueReader(JSONReader ctxt,
Class<?> type,
ValueReader defaultReader)
Method called after
ValueReader to use has been constructed, but
before it is to be used for the first time. |
ValueWriter |
modifyValueWriter(JSONWriter ctxt,
Class<?> type,
ValueWriter defaultWriter)
Method called after
ValueWriter to use has been constructed, but
before it is to be used for the first time. |
static ReaderWriterModifier |
of(ReaderWriterModifier primary,
ReaderWriterModifier secondary)
Factory method for "combining" given 2 modifiers so that if neither is
null ,
a ReaderWriterModifier.Pair is constructed; otherwise if one is non-null, that provider is returned;
or if both are null s, null is returned. |
ValueWriter |
overrideStandardValueWriter(JSONWriter ctxt,
Class<?> type,
int stdTypeId)
Method called instead of
ReaderWriterModifier.modifyValueWriter(com.fasterxml.jackson.jr.ob.impl.JSONWriter, java.lang.Class<?>, com.fasterxml.jackson.jr.ob.api.ValueWriter) for set of non-POJO
"standard" JDK types that do not have matching ValueWriter and are
normally directly serialized by JSONWriter itself. |
POJODefinition |
pojoDefinitionForDeserialization(JSONReader ctxt,
Class<?> pojoType) |
POJODefinition |
pojoDefinitionForSerialization(JSONWriter ctxt,
Class<?> pojoType) |
protected final ReaderWriterModifier _primary
protected final ReaderWriterModifier _secondary
protected Pair(ReaderWriterModifier p, ReaderWriterModifier s)
public static ReaderWriterModifier of(ReaderWriterModifier primary, ReaderWriterModifier secondary)
null
,
a ReaderWriterModifier.Pair
is constructed; otherwise if one is non-null, that provider is returned;
or if both are null
s, null
is returned.primary
- Primary providersecondary
- Secondary providernull
.public POJODefinition pojoDefinitionForDeserialization(JSONReader ctxt, Class<?> pojoType)
pojoDefinitionForDeserialization
in class ReaderWriterModifier
public POJODefinition pojoDefinitionForSerialization(JSONWriter ctxt, Class<?> pojoType)
pojoDefinitionForSerialization
in class ReaderWriterModifier
public ValueReader modifyValueReader(JSONReader ctxt, Class<?> type, ValueReader defaultReader)
ReaderWriterModifier
ValueReader
to use has been constructed, but
before it is to be used for the first time. Method may either return that
reader as-is, or construct a different ValueReader
and return that
to be used.
This method is often used to create a new ValueReader
that needs to
delegate to the original reader for some uses, but not all.
modifyValueReader
in class ReaderWriterModifier
ctxt
- Context that may be used to access configurationtype
- Type of values to readdefaultReader
- ValueReader
that is to be useddefaultReader
as-is, or an alternate ValueReader
to use.public ValueWriter modifyValueWriter(JSONWriter ctxt, Class<?> type, ValueWriter defaultWriter)
ReaderWriterModifier
ValueWriter
to use has been constructed, but
before it is to be used for the first time. Method may either return that
writer as-is, or construct a different ValueWriter
and return that
to be used.
Note that this method is NOT called for non-POJO JDK "standard" values that
jackson-jr supports (such as Number
s, String
and URL
); for these types, ReaderWriterModifier.overrideStandardValueWriter(com.fasterxml.jackson.jr.ob.impl.JSONWriter, java.lang.Class<?>, int)
is called instead.
This method is often used to create a new ValueReader
that needs to
delegate to the original reader for some uses, but not all.
modifyValueWriter
in class ReaderWriterModifier
ctxt
- Context that may be used to access configurationtype
- Type of values to writedefaultWriter
- ValueReader
that is to be useddefaultReader
as-is, or an alternate ValueWriter
to use;
must not return null
.public ValueWriter overrideStandardValueWriter(JSONWriter ctxt, Class<?> type, int stdTypeId)
ReaderWriterModifier
ReaderWriterModifier.modifyValueWriter(com.fasterxml.jackson.jr.ob.impl.JSONWriter, java.lang.Class<?>, com.fasterxml.jackson.jr.ob.api.ValueWriter)
for set of non-POJO
"standard" JDK types that do not have matching ValueWriter
and are
normally directly serialized by JSONWriter
itself.
Handler may either return null
to indicate "no override" or return
custom ValueWriter
to use.overrideStandardValueWriter
in class ReaderWriterModifier
ctxt
- Context that may be used to access configurationtype
- Type of values to writestdTypeId
- Internal identifier of standard type (not usually useful,
but could potentially be used for delegating)null
if no override should occur, or ValueWriter
to use.Copyright © 2020 FasterXML. All rights reserved.