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

public class MutuallyExclusiveConfigurationPropertiesException extends RuntimeException
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 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 configured
      mutuallyExclusiveNames - the names of the properties that are mutually exclusive
  • Method Details

    • getConfiguredNames

      public Set<String> getConfiguredNames()
      Return the names of the properties that have been configured.
      Returns:
      the names of the configured properties
    • getMutuallyExclusiveNames

      public Set<String> getMutuallyExclusiveNames()
      Return the names of the properties that are mutually exclusive.
      Returns:
      the names of the mutually exclusive properties
    • throwIfMultipleNonNullValuesIn

      public static void throwIfMultipleNonNullValuesIn(Consumer<Map<String,Object>> entries)
      Throw a new MutuallyExclusiveConfigurationPropertiesException 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 new MutuallyExclusiveConfigurationPropertiesException 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 check
      predicate - the predicate used to check for matching values
      Since:
      3.3.7