Class ConfigValidationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.openhab.core.config.core.validation.ConfigValidationException
All Implemented Interfaces:
Serializable

public final class ConfigValidationException extends RuntimeException
A runtime exception to be thrown if given Configuration parameters do not match their declaration in the ConfigDescription.
Author:
Thomas Höfer - Initial contribution
See Also:
  • Constructor Details

    • ConfigValidationException

      public ConfigValidationException(org.osgi.framework.Bundle bundle, TranslationProvider translationProvider, Collection<ConfigValidationMessage> configValidationMessages)
      Creates a new ConfigValidationException for the given ConfigValidationMessages. It requires the bundle from which this exception is thrown in order to be able to provide internationalized messages.
      Parameters:
      bundle - the bundle from which this exception is thrown
      configValidationMessages - the configuration description validation messages
      Throws:
      NullPointerException - if given bundle or configuration description validation messages are null
  • Method Details

    • getValidationMessages

      public Map<String,String> getValidationMessages()
      Retrieves the default validation messages (cp. ConfigValidationMessage.defaultMessage) for this exception.
      Returns:
      an immutable map of validation messages having affected configuration parameter name as key and the default message as value
    • getValidationMessages

      public Map<String,String> getValidationMessages(Locale locale)
      Retrieves the internationalized validation messages for this exception. If there is no text found to be internationalized then the default message is delivered.

      If there is no TranslationProvider available then this operation will return the default validation messages by using getValidationMessages().

      Parameters:
      locale - the locale to be used; if null then the default locale will be used
      Returns:
      an immutable map of internationalized validation messages having affected configuration parameter name as key and the internationalized message as value (in case of there was no text found to be internationalized then the default message (cp. ConfigValidationMessage.defaultMessage) is delivered)