Class MutuallyExclusiveConfigurationPropertiesException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException
- All Implemented Interfaces:
Serializable
Exception thrown when more than one mutually exclusive configuration property has been
configured.
- Since:
- 2.6.0
- Author:
- Andy Wilkinson, Phillip Webb
- See Also:
-
Constructor Summary
ConstructorDescriptionMutuallyExclusiveConfigurationPropertiesException
(Collection<String> configuredNames, Collection<String> mutuallyExclusiveNames) Creates a new instance for mutually exclusive configuration properties when two or more of those properties have been configured. -
Method Summary
Modifier and TypeMethodDescriptionReturn the names of the properties that have been configured.Return the names of the properties that are mutually exclusive.static <V> void
throwIfMultipleMatchingValuesIn
(Consumer<Map<String, V>> entries, Predicate<V> predicate) Throw a newMutuallyExclusiveConfigurationPropertiesException
if multiple values are defined in a set of entries that match the given predicate.static void
throwIfMultipleNonNullValuesIn
(Consumer<Map<String, Object>> entries) Throw a newMutuallyExclusiveConfigurationPropertiesException
if multiple non-null values are defined in a set of entries.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MutuallyExclusiveConfigurationPropertiesException
public MutuallyExclusiveConfigurationPropertiesException(Collection<String> configuredNames, Collection<String> mutuallyExclusiveNames) Creates a new instance for mutually exclusive configuration properties when two or more of those properties have been configured.- Parameters:
configuredNames
- the names of the properties that have been configuredmutuallyExclusiveNames
- the names of the properties that are mutually exclusive
-
-
Method Details
-
getConfiguredNames
Return the names of the properties that have been configured.- Returns:
- the names of the configured properties
-
getMutuallyExclusiveNames
Return the names of the properties that are mutually exclusive.- Returns:
- the names of the mutually exclusive properties
-
throwIfMultipleNonNullValuesIn
Throw a newMutuallyExclusiveConfigurationPropertiesException
if multiple non-null values are defined in a set of entries.- Parameters:
entries
- a consumer used to populate the entries to check
-
throwIfMultipleMatchingValuesIn
public static <V> void throwIfMultipleMatchingValuesIn(Consumer<Map<String, V>> entries, Predicate<V> predicate) Throw a newMutuallyExclusiveConfigurationPropertiesException
if multiple values are defined in a set of entries that match the given predicate.- Type Parameters:
V
- the value type- Parameters:
entries
- a consumer used to populate the entries to checkpredicate
- the predicate used to check for matching values- Since:
- 3.3.7
-