Interface YamlElement


public interface YamlElement
The YamlElement interface must be implemented by any classes that need to be handled by the YamlModelRepositoryImpl.

Implementations

  • MUST have a default constructor to allow deserialization with Jackson
  • MUST provide equals(Object other) and hashcode() methods
  • MUST be annotated with YamlElementName containing the element name
  • SHOULD implement a proper toString() method
Author:
Laurent Garnier - Initial contribution, Jan N. Klug - Refactoring and improvements to JavaDoc, Laurent Garnier - Added methods setId and cloneWithoutId
  • Method Summary

    Modifier and Type
    Method
    Description
    Clone this element putting the identifier to null.
    @NonNull String
    Get the identifier of this element.
    boolean
    Check if this element is valid and should be included in the model.
    void
    setId(@NonNull String id)
    Set the identifier of this element.
  • Method Details

    • getId

      @NonNull String getId()
      Get the identifier of this element.

      Identifiers

      • MUST be non-null
      • MUST be unique within a model
      • SHOULD be unique across all models
      Returns:
      the identifier as a string
    • setId

      void setId(@NonNull String id)
      Set the identifier of this element.
      Parameters:
      id - the identifier as a string
    • cloneWithoutId

      YamlElement cloneWithoutId()
      Clone this element putting the identifier to null.
      Returns:
      the cloned element
    • isValid

      boolean isValid()
      Check if this element is valid and should be included in the model.

      Implementations

      • MUST check that at least {link #getId()} returns a non-null value
      • SHOULD log the reason of failed checks at WARN level
      • MAY perform additional checks
      Returns:
      true if all the checks are completed successfully