Class ReaderWriterModifier

  • Direct Known Subclasses:
    ReaderWriterModifier.Pair

    public abstract class ReaderWriterModifier
    extends java.lang.Object
    API to implement to apply modifications to ValueReaders and ValueWriters of all kinds (default scalar ones, custom ones, POJO ones).
    Since:
    2.11
    • Constructor Detail

      • ReaderWriterModifier

        public ReaderWriterModifier()
    • 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 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 - Context that may be used to access configuration
        type - Type of values to read
        defaultReader - ValueReader that is to be used
        Returns:
        either defaultReader as-is, or an alternate ValueReader to use.
      • modifyValueWriter

        public ValueWriter modifyValueWriter​(JSONWriter writeContext,
                                             java.lang.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 Numbers, String and URL); 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 configuration
        type - Type of values to write
        defaultWriter - ValueReader that is to be used
        Returns:
        either defaultReader as-is, or an alternate ValueWriter to use; must not return null.