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
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 Summary
ConstructorDescriptionConfigValidationException
(org.osgi.framework.Bundle bundle, TranslationProvider translationProvider, Collection<ConfigValidationMessage> configValidationMessages) Creates a newConfigValidationException
for the givenConfigValidationMessage
s. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the default validation messages (cp.getValidationMessages
(Locale locale) Retrieves the internationalized validation messages for this exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ConfigValidationException
public ConfigValidationException(org.osgi.framework.Bundle bundle, TranslationProvider translationProvider, Collection<ConfigValidationMessage> configValidationMessages) Creates a newConfigValidationException
for the givenConfigValidationMessage
s. 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 thrownconfigValidationMessages
- the configuration description validation messages- Throws:
NullPointerException
- if given bundle or configuration description validation messages are null
-
-
Method Details
-
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
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)
-