Interface YamlModelListener<T extends YamlElement>


@NonNullByDefault public interface YamlModelListener<T extends YamlElement>
The YamlModelListener interface is responsible for managing a particular model type with data processed from YAML configuration files.

Implementors are notified whenever a YAML model changed that contains elements of the given type. They MUST declare at least YamlModelListener as service to automatically register them with the repository.

Author:
Laurent Garnier - Initial contribution
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addedModel(String modelName, Collection<T> elements)
    Method called by the model repository when elements from a model are added.
    Get the DTO class to be used for each object of this model type.
    void
    removedModel(String modelName, Collection<T> elements)
    Method called by the model repository when elements from a model are removed.
    void
    updatedModel(String modelName, Collection<T> elements)
    Method called by the model repository when elements from a model are updated.
  • Method Details

    • addedModel

      void addedModel(String modelName, Collection<T> elements)
      Method called by the model repository when elements from a model are added. Only added elements are contained in the collection. In case the listener is added after a model was read, this method is also called with all elements from that model.
      Parameters:
      modelName - the name of the model
      elements - the collection of added elements
    • updatedModel

      void updatedModel(String modelName, Collection<T> elements)
      Method called by the model repository when elements from a model are updated. Only changed elements are contained in the collection.
      Parameters:
      modelName - the name of the model
      elements - the collection of updated elements
    • removedModel

      void removedModel(String modelName, Collection<T> elements)
      Method called by the model repository when elements from a model are removed.
      Parameters:
      modelName - the name of the model
      elements - the collection of removed elements
    • getElementClass

      Class<T> getElementClass()
      Get the DTO class to be used for each object of this model type. The DTO class MUST implement YamlElement and fulfill all requirements defined for the interface.
      Returns:
      the DTO element class