Top Inners Fields Constructors Methods
com.fasterxml.jackson.jr.annotationsupport

public Class AnnotationBasedValueRWModifier

extends ReaderWriterModifier
Class Inheritance
Imports
java.io.IOException, java.lang.reflect.Field, .Method, .Modifier, java.util.*, com.fasterxml.jackson.annotation.JsonAutoDetect, .JsonCreator, .JsonProperty, .JsonValue, com.fasterxml.jackson.core.JsonGenerator, .JsonParser, com.fasterxml.jackson.jr.ob.JSONObjectException, com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier, .ValueReader, .ValueWriter, com.fasterxml.jackson.jr.ob.impl.JSONReader, .JSONWriter, .POJODefinition, .ValueLocatorBase

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AnnotationBasedValueRWModifier.EnumJsonCreatorReader

Deserialize into an enum using the JsonCreator tagged method

private static class
AnnotationBasedValueRWModifier.EnumJsonValueWriter

Serialize an enum using the JsonValue tagged method.

private static class

Field Summary

Modifier and TypeField and Description
protected final JsonAutoDetect.Value
_visibility

Visibility settings to use for auto-detecting accessors.

protected static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ValueReader
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
)

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
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
)

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
Inherited from com.fasterxml.jackson.jr.ob.api.ReaderWriterModifier:
modifyValueWriter

Field Detail

_visibilityback to summary
protected final JsonAutoDetect.Value _visibility

Visibility settings to use for auto-detecting accessors.

SER_ENUM_IDback to summary
protected static final int SER_ENUM_ID

Constructor Detail

AnnotationBasedValueRWModifierback to summary
public AnnotationBasedValueRWModifier(JsonAutoDetect.Value visibility)

Method Detail

modifyValueReaderback to summary
public ValueReader modifyValueReader(JSONReader readContext, 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
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.

Annotations
@Override
overrideStandardValueWriterback to summary
public ValueWriter overrideStandardValueWriter(JSONWriter writeContext, 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
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.

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

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

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

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

Annotations
@Override
com.fasterxml.jackson.jr.annotationsupport back to summary

private Class AnnotationBasedValueRWModifier.EnumJsonCreatorReader

extends ValueReader
Class Inheritance

Deserialize into an enum using the JsonCreator tagged method
Since
2.14

Field Summary

Modifier and TypeField and Description
private final Method
Inherited from com.fasterxml.jackson.jr.ob.api.ValueReader:
_valueType

Constructor Summary

AccessConstructor and Description
private
EnumJsonCreatorReader(Class<?> valueType, Method jsonCreatorMethod)

Method Summary

Modifier and TypeMethod and Description
public static AnnotationBasedValueRWModifier.EnumJsonCreatorReader

Returns:

a new EnumJsonCreatorReader to deserialize with, or null if there is no JsonCreator method to use
of
(Class<?>
the type to scan
type
)

Scan the methods of the enum type to find a static method tagged with JsonCreator which takes exactly one parameter and returns a value of the enum's type

public Object
read(JSONReader
Context object that allows calling other read methods for contained values of different types (for example for collection readers).
reader
,
JsonParser
Underlying parser used for reading decoded token stream
p
)

Implements abstract com.fasterxml.jackson.jr.ob.api.ValueReader.read.

Method called to deserialize value of type supported by this reader, using given parser.

Inherited from com.fasterxml.jackson.jr.ob.api.ValueReader:
_tokenDesc_tokenDescreadNextvalueType

Field Detail

_jsonCreatorMethodback to summary
private final Method _jsonCreatorMethod

Constructor Detail

EnumJsonCreatorReaderback to summary
private EnumJsonCreatorReader(Class<?> valueType, Method jsonCreatorMethod)

Method Detail

ofback to summary
public static AnnotationBasedValueRWModifier.EnumJsonCreatorReader of(Class<?> type)

Scan the methods of the enum type to find a static method tagged with JsonCreator which takes exactly one parameter and returns a value of the enum's type

Parameters
type:Class<?>

the type to scan

Returns:AnnotationBasedValueRWModifier.EnumJsonCreatorReader

a new EnumJsonCreatorReader to deserialize with, or null if there is no JsonCreator method to use

readback to summary
public Object read(JSONReader reader, JsonParser p) throws IOException

Implements abstract com.fasterxml.jackson.jr.ob.api.ValueReader.read.

Doc from com.fasterxml.jackson.jr.ob.api.ValueReader.read.

Method called to deserialize value of type supported by this reader, using given parser. Parser is already positioned to the (first) token of the value to read.

Parameters
reader:JSONReader

Context object that allows calling other read methods for contained values of different types (for example for collection readers).

p:JsonParser

Underlying parser used for reading decoded token stream

Annotations
@Override
com.fasterxml.jackson.jr.annotationsupport back to summary

private Class AnnotationBasedValueRWModifier.EnumJsonValueWriter

extends Object
implements ValueWriter
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.jr.annotationsupport.AnnotationBasedValueRWModifier.EnumJsonValueWriter
All Implemented Interfaces
com.fasterxml.jackson.jr.ob.api.ValueWriter

Serialize an enum using the JsonValue tagged method.
Since
2.14

Field Summary

Modifier and TypeField and Description
private final Method
private final Class<?>

Constructor Summary

AccessConstructor and Description
private
EnumJsonValueWriter(Class<?> _valueType, Method _jsonValueMethod)

Method Summary

Modifier and TypeMethod and Description
private static AnnotationBasedValueRWModifier.EnumJsonValueWriter
getJsonValueFunction(Class<?> type, Class<?> inspectionType)

public static AnnotationBasedValueRWModifier.EnumJsonValueWriter

Returns:

either a EnumJsonValueWriter to write this enum with, or null if no suitable method found
of
(Class<?>
the type
type
)

Scan the methods of the enum to find a JsonValue tagged method which takes no parameters and returns a String

public Class<?>
valueType()

Implements com.fasterxml.jackson.jr.ob.api.ValueWriter.valueType.

Accessor for non-generic (type-erased) type of values this reader produces from input.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_jsonValueMethodback to summary
private final Method _jsonValueMethod
_valueTypeback to summary
private final Class<?> _valueType

Constructor Detail

EnumJsonValueWriterback to summary
private EnumJsonValueWriter(Class<?> _valueType, Method _jsonValueMethod)

Method Detail

getJsonValueFunctionback to summary
private static AnnotationBasedValueRWModifier.EnumJsonValueWriter getJsonValueFunction(Class<?> type, Class<?> inspectionType)
ofback to summary
public static AnnotationBasedValueRWModifier.EnumJsonValueWriter of(Class<?> type)

Scan the methods of the enum to find a JsonValue tagged method which takes no parameters and returns a String

Parameters
type:Class<?>

the type

Returns:AnnotationBasedValueRWModifier.EnumJsonValueWriter

either a EnumJsonValueWriter to write this enum with, or null if no suitable method found

valueTypeback to summary
public Class<?> valueType()

Implements com.fasterxml.jackson.jr.ob.api.ValueWriter.valueType.

Doc from com.fasterxml.jackson.jr.ob.api.ValueWriter.valueType.

Accessor for non-generic (type-erased) type of values this reader produces from input.

Annotations
@Override
writeValueback to summary
public void writeValue(JSONWriter context, JsonGenerator g, Object value) throws IOException

Implements com.fasterxml.jackson.jr.ob.api.ValueWriter.writeValue.

Annotations
@Override
com.fasterxml.jackson.jr.annotationsupport back to summary

private Class AnnotationBasedValueRWModifier.EnumWriter

extends Object
implements ValueWriter
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.jr.annotationsupport.AnnotationBasedValueRWModifier.EnumWriter
All Implemented Interfaces
com.fasterxml.jackson.jr.ob.api.ValueWriter

Field Summary

Modifier and TypeField and Description
private final Class<?>
private final Map<String, String>

Constructor Summary

AccessConstructor and Description
public
EnumWriter(Class<?> type)

Method Summary

Modifier and TypeMethod and Description
public Class<?>
valueType()

Implements com.fasterxml.jackson.jr.ob.api.ValueWriter.valueType.

Accessor for non-generic (type-erased) type of values this reader produces from input.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_valueTypeback to summary
private final Class<?> _valueType
enumMapback to summary
private final Map<String, String> enumMap

Constructor Detail

EnumWriterback to summary
public EnumWriter(Class<?> type)

Method Detail

valueTypeback to summary
public Class<?> valueType()

Implements com.fasterxml.jackson.jr.ob.api.ValueWriter.valueType.

Doc from com.fasterxml.jackson.jr.ob.api.ValueWriter.valueType.

Accessor for non-generic (type-erased) type of values this reader produces from input.

Annotations
@Override
writeValueback to summary
public void writeValue(JSONWriter context, JsonGenerator g, Object value) throws IOException

Implements com.fasterxml.jackson.jr.ob.api.ValueWriter.writeValue.

Annotations
@Override