Package com.fasterxml.jackson.jr.ob.api
Class ReaderWriterModifier
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier
-
- Direct Known Subclasses:
ReaderWriterModifier.Pair
public abstract class ReaderWriterModifier extends java.lang.ObjectAPI to implement to apply modifications toValueReaders andValueWriters of all kinds (default scalar ones, custom ones, POJO ones).- Since:
- 2.11
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReaderWriterModifier.PairImplementation that allows chaining of two modifiers, one (first) with higher precedence than the other (second).
-
Constructor Summary
Constructors Constructor Description ReaderWriterModifier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueReadermodifyValueReader(JSONReader readContext, 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 writeContext, java.lang.Class<?> type, ValueWriter defaultWriter)Method called afterValueWriterto use has been constructed, but before it is to be used for the first time.ValueWriteroverrideStandardValueWriter(JSONWriter writeContext, java.lang.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.POJODefinitionpojoDefinitionForDeserialization(JSONReader readContext, java.lang.Class<?> pojoType)POJODefinitionpojoDefinitionForSerialization(JSONWriter writeContext, java.lang.Class<?> pojoType)
-
-
-
Method Detail
-
pojoDefinitionForDeserialization
public POJODefinition pojoDefinitionForDeserialization(JSONReader readContext, java.lang.Class<?> pojoType)
-
pojoDefinitionForSerialization
public POJODefinition pojoDefinitionForSerialization(JSONWriter writeContext, java.lang.Class<?> pojoType)
-
modifyValueReader
public ValueReader modifyValueReader(JSONReader readContext, java.lang.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, java.lang.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, java.lang.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.
-
-