Top Description Inners Constructors Methods
com.fasterxml.jackson.jr.ob.api

public abstract Class ReaderWriterModifier

extends Object
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.Pair
Imports
com.fasterxml.jackson.jr.ob.impl.JSONReader, .JSONWriter, .POJODefinition

API to implement to apply modifications to ValueReaders and ValueWriters of all kinds (default scalar ones, custom ones, POJO ones).
Since
2.11

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ReaderWriterModifier.Pair

Implementation that allows chaining of two modifiers, one (first) with higher precedence than the other (second).

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ValueReader

Returns:

either defaultReader as-is, or an alternate ValueReader to use.
modifyValueReader
(JSONReader
Context that may be used to access configuration
readContext
,
Class<?>
Type of values to read
type
,
ValueReader
ValueReader that is to be used
defaultReader
)

Method called after ValueReader to use has been constructed, but before it is to be used for the first time.

public ValueWriter

Returns:

either defaultReader as-is, or an alternate ValueWriter to use; must not return null.
modifyValueWriter
(JSONWriter
Context that may be used to access configuration
writeContext
,
Class<?>
Type of values to write
type
,
ValueWriter
ValueReader that is to be used
defaultWriter
)

Method called after ValueWriter to use has been constructed, but before it is to be used for the first time.

public ValueWriter

Returns:

null if no override should occur, or ValueWriter to use.
overrideStandardValueWriter
(JSONWriter
Context that may be used to access configuration
writeContext
,
Class<?>
Type of values to write
type
,
int
Internal identifier of standard type (not usually useful, but could potentially be used for delegating)
stdTypeId
)

Method called instead of modifyValueWriter for set of non-POJO "standard" JDK types that do not have matching ValueWriter and are normally directly serialized by JSONWriter itself.

public POJODefinition
public POJODefinition
pojoDefinitionForSerialization(JSONWriter writeContext, Class<?> pojoType)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ReaderWriterModifierback to summary
public ReaderWriterModifier()

Method Detail

modifyValueReaderback to summary
public ValueReader modifyValueReader(JSONReader readContext, Class<?> type, ValueReader defaultReader)

Method called after ValueReader 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 different ValueReader 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:JSONReader

Context that may be used to access configuration

type:Class<?>

Type of values to read

defaultReader:ValueReader

ValueReader that is to be used

Returns:ValueReader

either defaultReader as-is, or an alternate ValueReader to use.

modifyValueWriterback to summary
public ValueWriter modifyValueWriter(JSONWriter writeContext, Class<?> type, ValueWriter defaultWriter)

Method called after ValueWriter 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 different ValueWriter 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 java.lang.Numbers, java.lang.String and java.net.URL); for these types, overrideStandardValueWriter 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:JSONWriter

Context that may be used to access configuration

type:Class<?>

Type of values to write

defaultWriter:ValueWriter

ValueReader that is to be used

Returns:ValueWriter

either defaultReader as-is, or an alternate ValueWriter to use; must not return null.

overrideStandardValueWriterback to summary
public ValueWriter overrideStandardValueWriter(JSONWriter writeContext, Class<?> type, int stdTypeId)

Method called instead of modifyValueWriter for set of non-POJO "standard" JDK types that do not have matching ValueWriter and are normally directly serialized by JSONWriter itself. Handler may either return null to indicate "no override" or return custom ValueWriter to use.

Parameters
writeContext:JSONWriter

Context that may be used to access configuration

type:Class<?>

Type of values to write

stdTypeId:int

Internal identifier of standard type (not usually useful, but could potentially be used for delegating)

Returns:ValueWriter

null if no override should occur, or ValueWriter to use.

pojoDefinitionForDeserializationback to summary
public POJODefinition pojoDefinitionForDeserialization(JSONReader readContext, Class<?> pojoType)
pojoDefinitionForSerializationback to summary
public POJODefinition pojoDefinitionForSerialization(JSONWriter writeContext, Class<?> pojoType)
com.fasterxml.jackson.jr.ob.api back to summary

public Class ReaderWriterModifier.Pair

extends ReaderWriterModifier
Class Inheritance

Implementation that allows chaining of two modifiers, one (first) with higher precedence than the other (second).

Field Summary

Modifier and TypeField and Description
protected final ReaderWriterModifier
protected final ReaderWriterModifier

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public ValueReader
modifyValueReader(JSONReader
Context that may be used to access configuration
ctxt
,
Class<?>
Type of values to read
type
,
ValueReader
ValueReader that is to be used
defaultReader
)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.modifyValueReader.

Method called after ValueReader to use has been constructed, but before it is to be used for the first time.

public ValueWriter
modifyValueWriter(JSONWriter
Context that may be used to access configuration
ctxt
,
Class<?>
Type of values to write
type
,
ValueWriter
ValueReader that is to be used
defaultWriter
)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.modifyValueWriter.

Method called after ValueWriter to use has been constructed, but before it is to be used for the first time.

public static ReaderWriterModifier

Returns:

Provider instance either constructed (2 non-null providers), or non-null provider given as-is, or, if both nulls, null.
of
(ReaderWriterModifier
Primary provider
primary
,
ReaderWriterModifier
Secondary provider
secondary
)

Factory method for "combining" given 2 modifiers so that if neither is null, a Pair is constructed; otherwise if one is non-null, that provider is returned; or if both are nulls, null is returned.

public ValueWriter
overrideStandardValueWriter(JSONWriter
Context that may be used to access configuration
ctxt
,
Class<?>
Type of values to write
type
,
int
Internal identifier of standard type (not usually useful, but could potentially be used for delegating)
stdTypeId
)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.overrideStandardValueWriter.

Method called instead of modifyValueWriter for set of non-POJO "standard" JDK types that do not have matching ValueWriter and are normally directly serialized by JSONWriter itself.

public POJODefinition
public POJODefinition

Field Detail

_primaryback to summary
protected final ReaderWriterModifier _primary
_secondaryback to summary
protected final ReaderWriterModifier _secondary

Constructor Detail

Pairback to summary
protected Pair(ReaderWriterModifier p, ReaderWriterModifier s)

Method Detail

modifyValueReaderback to summary
public ValueReader modifyValueReader(JSONReader ctxt, Class<?> type, ValueReader defaultReader)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.modifyValueReader.

Doc from com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.modifyValueReader.

Method called after ValueReader 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 different ValueReader 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
ctxt:JSONReader

Context that may be used to access configuration

type:Class<?>

Type of values to read

defaultReader:ValueReader

ValueReader that is to be used

Returns:ValueReader

either defaultReader as-is, or an alternate ValueReader to use.

Annotations
@Override
modifyValueWriterback to summary
public ValueWriter modifyValueWriter(JSONWriter ctxt, Class<?> type, ValueWriter defaultWriter)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.modifyValueWriter.

Doc from com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.modifyValueWriter.

Method called after ValueWriter 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 different ValueWriter 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 java.lang.Numbers, java.lang.String and java.net.URL); for these types, overrideStandardValueWriter 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
ctxt:JSONWriter

Context that may be used to access configuration

type:Class<?>

Type of values to write

defaultWriter:ValueWriter

ValueReader that is to be used

Returns:ValueWriter

either defaultReader as-is, or an alternate ValueWriter to use; must not return null.

Annotations
@Override
ofback to summary
public static ReaderWriterModifier of(ReaderWriterModifier primary, ReaderWriterModifier secondary)

Factory method for "combining" given 2 modifiers so that if neither is null, a Pair is constructed; otherwise if one is non-null, that provider is returned; or if both are nulls, null is returned.

Parameters
primary:ReaderWriterModifier

Primary provider

secondary:ReaderWriterModifier

Secondary provider

Returns:ReaderWriterModifier

Provider instance either constructed (2 non-null providers), or non-null provider given as-is, or, if both nulls, null.

overrideStandardValueWriterback to summary
public ValueWriter overrideStandardValueWriter(JSONWriter ctxt, Class<?> type, int stdTypeId)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.overrideStandardValueWriter.

Doc from com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.overrideStandardValueWriter.

Method called instead of modifyValueWriter for set of non-POJO "standard" JDK types that do not have matching ValueWriter and are normally directly serialized by JSONWriter itself. Handler may either return null to indicate "no override" or return custom ValueWriter to use.

Parameters
ctxt:JSONWriter

Context that may be used to access configuration

type:Class<?>

Type of values to write

stdTypeId:int

Internal identifier of standard type (not usually useful, but could potentially be used for delegating)

Returns:ValueWriter

null if no override should occur, or ValueWriter to use.

Annotations
@Override
pojoDefinitionForDeserializationback to summary
public POJODefinition pojoDefinitionForDeserialization(JSONReader ctxt, Class<?> pojoType)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.pojoDefinitionForDeserialization.

Annotations
@Override
pojoDefinitionForSerializationback to summary
public POJODefinition pojoDefinitionForSerialization(JSONWriter ctxt, Class<?> pojoType)

Overrides com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier.pojoDefinitionForSerialization.

Annotations
@Override