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_primaryprotected ReaderWriterModifier_secondary
-
Constructor Summary
Constructors Modifier Constructor Description protectedPair(ReaderWriterModifier p, ReaderWriterModifier s)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueReadermodifyValueReader(JSONReader ctxt, java.lang.Class<?> type, ValueReader defaultReader)Method called afterValueReaderto use has been constructed, but before it is to be used for the first time.ValueWritermodifyValueWriter(JSONWriter ctxt, java.lang.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.ValueWriteroverrideStandardValueWriter(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 matchingValueWriterand are normally directly serialized byJSONWriteritself.POJODefinitionpojoDefinitionForDeserialization(JSONReader ctxt, java.lang.Class<?> pojoType)POJODefinitionpojoDefinitionForSerialization(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.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
public POJODefinition pojoDefinitionForDeserialization(JSONReader ctxt, java.lang.Class<?> pojoType)
- Overrides:
pojoDefinitionForDeserializationin classReaderWriterModifier
-
pojoDefinitionForSerialization
public POJODefinition pojoDefinitionForSerialization(JSONWriter ctxt, java.lang.Class<?> pojoType)
- Overrides:
pojoDefinitionForSerializationin classReaderWriterModifier
-
modifyValueReader
public ValueReader modifyValueReader(JSONReader ctxt, java.lang.Class<?> type, ValueReader defaultReader)
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
public ValueWriter modifyValueWriter(JSONWriter ctxt, java.lang.Class<?> type, ValueWriter defaultWriter)
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
public ValueWriter overrideStandardValueWriter(JSONWriter ctxt, java.lang.Class<?> type, int stdTypeId)
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.
-
-