Package org.openhab.core.model.yaml
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)andhashcode()methods - MUST be annotated with
YamlElementNamecontaining 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, Laurent Garnier - Added parameters to method isValid
-
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
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
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
- Parameters:
errors- a list of error messages to fill with fatal invalid controls; can be null to ignore messageswarnings- a list of warning messages to fill with non-fatal invalid controls; can be null to ignore messages- Returns:
trueif all the checks are completed successfully
-