Interface DeserializeContext

All Superinterfaces:
ConfigurationDefinition.ReadOptions, ErrorContext.Source, UpdateListener
All Known Subinterfaces:
DeserializeInput

public interface DeserializeContext extends ConfigurationDefinition.ReadOptions, ErrorContext.Source
A context for deserialization.

This context identifies the location where deserialization is taking place, as well as global settings like the key mapper. It extends ConfigurationDefinition.ReadOptions and can be immediately used as such.

Implementation

Instances of this type are implemented by the library and supplied during type deserialization handling. Equality is not defined, and no thread safety is provided.

This type should not be implemented by library consumers. New methods may be added in the future, and this interface should be considered sealed. If library consumers decide to implement this interface, they might expose themselves to NoSuchMethodErrors if they pass their implementation to more up-to-date liaisons.

  • Method Details

    • keyMapper

      @NonNull KeyMapper keyMapper()
      Gets the key mapper.

      The key mapper is whichever key mapper is being used for the read operation.

      If using Configuration.configureWith(Backend), the key mapper may have been recommended by Backend.recommendKeyMapper() even if no key mapper was set on the configuration. It is provided here for purposes of deserializing child options in configuration subsections.

      Specified by:
      keyMapper in interface ConfigurationDefinition.ReadOptions
      Returns:
      the key mapper
    • keyPath

      @NonNull KeyPath keyPath()
      Gets the absolute key path of the enclosing context.

      This path will automatically include all key parts from the configuration root all the way until the current entry. It should be used for diagnostic purposes, as it has no functional meaning, and might include debug symbols (like "$0" for list entries).

      Specified by:
      keyPath in interface ConfigurationDefinition.ReadOptions
      Returns:
      the absolute key path
    • notifyUpdate

      void notifyUpdate(@NonNull KeyPath subPath, @NonNull UpdateReason updateReason)
      Signals that the data could use an update with respect to this object. For example, this might happen if missing options were filled in with default values, and those default values need to be written to the backend.

      This function does not actually perform any updating. It is merely a notification that this object (or a part within it) is updatable. For actual in-place updates, make sure to implement SerializeDeserialize.deserializeUpdate(DeserializeInput, SerializeOutput) and submit an updated value to the SerializeOutput in the same place as where you call this method.

      If the path being updated is a sub-path of the current context, then that sub-path should be provided as a non-empty parameter. An empty path should be passed if no sub-path exists.

      Specified by:
      notifyUpdate in interface UpdateListener
      Parameters:
      subPath - the sub path to be updated. May be empty if none exists. This path is relative to the location of the current context, meaning it should not overlap with keyPath()
      updateReason - the reason that such path might be updated. May be UpdateReason.OTHER if unknown