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.Object
API to implement to apply modifications toValueReader
s andValueWriter
s of all kinds (default scalar ones, custom ones, POJO ones).- Since:
- 2.11
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReaderWriterModifier.Pair
Implementation 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 ValueReader
modifyValueReader(JSONReader readContext, 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 writeContext, 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.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 matchingValueWriter
and are normally directly serialized byJSONWriter
itself.POJODefinition
pojoDefinitionForDeserialization(JSONReader readContext, java.lang.Class<?> pojoType)
POJODefinition
pojoDefinitionForSerialization(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 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.- Parameters:
readContext
- 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 writeContext, 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. 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,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.- Parameters:
writeContext
- 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 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 matchingValueWriter
and are normally directly serialized byJSONWriter
itself. Handler may either returnnull
to indicate "no override" or return customValueWriter
to 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:
null
if no override should occur, orValueWriter
to use.
-
-