Class PossibleModule

  • All Implemented Interfaces:
    com.fasterxml.jackson.core.Versioned

    public class PossibleModule
    extends Module
    • Field Detail

      • DEFAULT_READ_NULL_AS_ABSENT

        public static final boolean DEFAULT_READ_NULL_AS_ABSENT
        See Also:
        Constant Field Values
    • Constructor Detail

      • PossibleModule

        public PossibleModule()
    • Method Detail

      • version

        public com.fasterxml.jackson.core.Version version()
        Specified by:
        version in interface com.fasterxml.jackson.core.Versioned
        Specified by:
        version in class Module
      • configureReadNullAsAbsent

        public PossibleModule configureReadNullAsAbsent​(boolean value)
        Method to configure reading null values to Possible fields. If set to true, values will be deserialized to Possible.absent(), to be used as an escape hatch and accept null values into a Possible<T> field, avoiding a ValueInstantiationException. In this regard, you would set this method to true only if you encounter such exceptions due to incorrect field type or a transient issue with the JSON input.

        It is imperative to consider this can also interfere with methods that have distinct "null" vs "absent" behavior, and that writing a read value with this setting to true can lead to semantic differences.

        If set to false, creates a Possible.of(Optional.empty)) instance when reading a null value, meaning only a Possible<Optional<T>> field is the type to properly work with this setting.

        Defaults to DEFAULT_READ_NULL_AS_ABSENT.

        Parameters:
        value - whether to enable or disable this feature
        Returns:
        this module