Package com.fasterxml.jackson.jr.ob.api
Class ReaderWriterModifier
java.lang.Object
com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier
- Direct Known Subclasses:
ReaderWriterModifier.Pair
API to implement to apply modifications to
ValueReaders and
ValueWriters of all kinds (default scalar ones, custom ones,
POJO ones).- Since:
- 2.11
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImplementation that allows chaining of two modifiers, one (first) with higher precedence than the other (second). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmodifyValueReader(JSONReader readContext, Class<?> type, ValueReader defaultReader) Method called afterValueReaderto use has been constructed, but before it is to be used for the first time.modifyValueWriter(JSONWriter writeContext, Class<?> type, ValueWriter defaultWriter) Method called afterValueWriterto use has been constructed, but before it is to be used for the first time.overrideStandardValueWriter(JSONWriter writeContext, Class<?> type, int stdTypeId) Method called instead ofmodifyValueWriter(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 readContext, Class<?> pojoType) pojoDefinitionForSerialization(JSONWriter writeContext, Class<?> pojoType)
-
Constructor Details
-
ReaderWriterModifier
public ReaderWriterModifier()
-
-
Method Details
-
pojoDefinitionForDeserialization
-
pojoDefinitionForSerialization
-
modifyValueReader
public ValueReader modifyValueReader(JSONReader readContext, Class<?> type, ValueReader defaultReader) Method 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.- Parameters:
readContext- 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 writeContext, Class<?> type, ValueWriter defaultWriter) Method 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,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.- Parameters:
writeContext- 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 writeContext, Class<?> type, int stdTypeId) Method called instead ofmodifyValueWriter(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.- Parameters:
writeContext- 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.
-