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
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
FieldsModifier and TypeFieldDescriptionprotected final ReaderWriterModifierprotected final ReaderWriterModifier -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmodifyValueReader(JSONReader ctxt, Class<?> type, ValueReader defaultReader) Method called afterValueReaderto use has been constructed, but before it is to be used for the first time.modifyValueWriter(JSONWriter ctxt, Class<?> type, ValueWriter defaultWriter) Method called afterValueWriterto use has been constructed, but before it is to be used for the first time.static ReaderWriterModifierof(ReaderWriterModifier primary, ReaderWriterModifier secondary) Factory method for "combining" given 2 modifiers so that if neither isnull, aReaderWriterModifier.Pairis constructed; otherwise if one is non-null, that provider is returned; or if both arenulls,nullis returned.overrideStandardValueWriter(JSONWriter ctxt, 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 matchingValueWriterand are normally directly serialized byJSONWriteritself.pojoDefinitionForDeserialization(JSONReader ctxt, Class<?> pojoType) pojoDefinitionForSerialization(JSONWriter ctxt, Class<?> pojoType)
-
Field Details
-
_primary
-
_secondary
-
-
Constructor Details
-
Pair
-
-
Method Details
-
of
Factory method for "combining" given 2 modifiers so that if neither isnull, aReaderWriterModifier.Pairis constructed; otherwise if one is non-null, that provider is returned; or if both arenulls,nullis 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
- Overrides:
pojoDefinitionForDeserializationin classReaderWriterModifier
-
pojoDefinitionForSerialization
- Overrides:
pojoDefinitionForSerializationin classReaderWriterModifier
-
modifyValueReader
Description copied from class:ReaderWriterModifierMethod called afterValueReaderto 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 differentValueReaderand return that to be used.This method is often used to create a new
ValueReaderthat needs to delegate to the original reader for some uses, but not all.- Overrides:
modifyValueReaderin classReaderWriterModifier- Parameters:
ctxt- Context that may be used to access configurationtype- Type of values to readdefaultReader-ValueReaderthat is to be used- Returns:
- either
defaultReaderas-is, or an alternateValueReaderto use.
-
modifyValueWriter
Description copied from class:ReaderWriterModifierMethod called afterValueWriterto 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 differentValueWriterand return that to be used.Note that this method is NOT called for non-POJO JDK "standard" values that jackson-jr supports (such as
Numbers,StringandURL); 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
ValueReaderthat needs to delegate to the original reader for some uses, but not all.- Overrides:
modifyValueWriterin classReaderWriterModifier- Parameters:
ctxt- Context that may be used to access configurationtype- Type of values to writedefaultWriter-ValueReaderthat is to be used- Returns:
- either
defaultReaderas-is, or an alternateValueWriterto use; must not returnnull.
-
overrideStandardValueWriter
Description copied from class:ReaderWriterModifierMethod 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 matchingValueWriterand are normally directly serialized byJSONWriteritself. Handler may either returnnullto indicate "no override" or return customValueWriterto use.- Overrides:
overrideStandardValueWriterin 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:
nullif no override should occur, orValueWriterto use.
-