Package com.fasterxml.jackson.jr.ob.api
Class ReaderWriterModifier.Pair
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier
-
- com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.Pair
-
- Enclosing class:
- ReaderWriterModifier
public static class ReaderWriterModifier.Pair extends ReaderWriterModifier
Implementation that allows chaining of two modifiers, one (first) with higher precedence than the other (second).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier
ReaderWriterModifier.Pair
-
-
Field Summary
Fields Modifier and Type Field Description protected ReaderWriterModifier
_primary
protected ReaderWriterModifier
_secondary
-
Constructor Summary
Constructors Modifier Constructor Description protected
Pair(ReaderWriterModifier p, ReaderWriterModifier s)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueReader
modifyValueReader(JSONReader ctxt, java.lang.Class<?> type, ValueReader defaultReader)
Method called afterValueReader
to use has been constructed, but before it is to be used for the first time.ValueWriter
modifyValueWriter(JSONWriter ctxt, java.lang.Class<?> type, ValueWriter defaultWriter)
Method called afterValueWriter
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 isnull
, aReaderWriterModifier.Pair
is constructed; otherwise if one is non-null, that provider is returned; or if both arenull
s,null
is returned.ValueWriter
overrideStandardValueWriter(JSONWriter ctxt, java.lang.Class<?> type, int stdTypeId)
Method called instead ofReaderWriterModifier.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 matchingValueWriter
and are normally directly serialized byJSONWriter
itself.POJODefinition
pojoDefinitionForDeserialization(JSONReader ctxt, java.lang.Class<?> pojoType)
POJODefinition
pojoDefinitionForSerialization(JSONWriter ctxt, java.lang.Class<?> pojoType)
-
-
-
Field Detail
-
_primary
protected final ReaderWriterModifier _primary
-
_secondary
protected final ReaderWriterModifier _secondary
-
-
Constructor Detail
-
Pair
protected Pair(ReaderWriterModifier p, ReaderWriterModifier s)
-
-
Method Detail
-
of
public static ReaderWriterModifier of(ReaderWriterModifier primary, ReaderWriterModifier secondary)
Factory method for "combining" given 2 modifiers so that if neither isnull
, aReaderWriterModifier.Pair
is constructed; otherwise if one is non-null, that provider is returned; or if both arenull
s,null
is returned.- Parameters:
primary
- Primary providersecondary
- Secondary provider- Returns:
- Provider instance either constructed (2 non-null providers), or non-null provider
given as-is, or, if both nulls,
null
.
-
pojoDefinitionForDeserialization
public POJODefinition pojoDefinitionForDeserialization(JSONReader ctxt, java.lang.Class<?> pojoType)
- Overrides:
pojoDefinitionForDeserialization
in classReaderWriterModifier
-
pojoDefinitionForSerialization
public POJODefinition pojoDefinitionForSerialization(JSONWriter ctxt, java.lang.Class<?> pojoType)
- Overrides:
pojoDefinitionForSerialization
in classReaderWriterModifier
-
modifyValueReader
public ValueReader modifyValueReader(JSONReader ctxt, java.lang.Class<?> type, ValueReader defaultReader)
Description copied from class:ReaderWriterModifier
Method called afterValueReader
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 differentValueReader
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.- Overrides:
modifyValueReader
in classReaderWriterModifier
- Parameters:
ctxt
- Context that may be used to access configurationtype
- Type of values to readdefaultReader
-ValueReader
that is to be used- Returns:
- either
defaultReader
as-is, or an alternateValueReader
to use.
-
modifyValueWriter
public ValueWriter modifyValueWriter(JSONWriter ctxt, java.lang.Class<?> type, ValueWriter defaultWriter)
Description copied from class:ReaderWriterModifier
Method called afterValueWriter
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 differentValueWriter
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
andURL
); 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.- Overrides:
modifyValueWriter
in classReaderWriterModifier
- Parameters:
ctxt
- Context that may be used to access configurationtype
- Type of values to writedefaultWriter
-ValueReader
that is to be used- Returns:
- either
defaultReader
as-is, or an alternateValueWriter
to use; must not returnnull
.
-
overrideStandardValueWriter
public ValueWriter overrideStandardValueWriter(JSONWriter ctxt, java.lang.Class<?> type, int stdTypeId)
Description copied from class:ReaderWriterModifier
Method called instead ofReaderWriterModifier.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 matchingValueWriter
and are normally directly serialized byJSONWriter
itself. Handler may either returnnull
to indicate "no override" or return customValueWriter
to use.- Overrides:
overrideStandardValueWriter
in classReaderWriterModifier
- Parameters:
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)- Returns:
null
if no override should occur, orValueWriter
to use.
-
-