Interface IModelInstanceReadHandler<ITEM>

Type Parameters:
ITEM - the Java type of items being read
All Known Implementing Classes:
AbstractModelInstanceReadHandler

public interface IModelInstanceReadHandler<ITEM>
Handler interface for reading model instance collections during deserialization.

This interface provides methods for accepting individual items read from a stream and combining them into a collection.

  • Method Summary

    Modifier and Type
    Method
    Description
    Get the name of the JSON key flag, if one is configured for this instance.
    Read the next item in the collection of items represented by the instance.
    Read items into a list collection.
    Read items into a map collection, keyed by JSON key flag value.
    default ITEM
    Read a singleton item.
  • Method Details

    • readSingleton

      @Nullable default ITEM readSingleton() throws IOException
      Read a singleton item.
      Returns:
      the item read, or null if no item was present
      Throws:
      IOException - if an error occurred while reading the input
    • readList

      @NonNull List<ITEM> readList() throws IOException
      Read items into a list collection.
      Returns:
      the list of items read
      Throws:
      IOException - if an error occurred while reading the input
    • readMap

      @NonNull Map<String,ITEM> readMap() throws IOException
      Read items into a map collection, keyed by JSON key flag value.
      Returns:
      the map of items read, keyed by JSON key flag value
      Throws:
      IOException - if an error occurred while reading the input
    • readItem

      @Nullable ITEM readItem() throws IOException
      Read the next item in the collection of items represented by the instance.
      Returns:
      the Java object representing the item, or null if no items remain to be read
      Throws:
      IOException - if an error occurred while parsing the input
    • getJsonKeyFlagName

      Get the name of the JSON key flag, if one is configured for this instance.
      Returns:
      the JSON key flag name, or null if no JSON key is configured