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 having a version that is supported by this manager.

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, Laurent Garnier - Added basic version management
  • 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.
    boolean
    Indicates whether this manager is deprecated.
    boolean
    isVersionSupported(int version)
    Indicates whether a YAML file version is supported.
    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
    • isVersionSupported

      boolean isVersionSupported(int version)
      Indicates whether a YAML file version is supported.
      Parameters:
      version - the YAML file version to check
      Returns:
      true if the version is supported
    • isDeprecated

      boolean isDeprecated()
      Indicates whether this manager is deprecated.
      Returns:
      true if this manager is deprecated