Class ConfigurationParameters

java.lang.Object
org.apache.jackrabbit.oak.spi.security.ConfigurationParameters
All Implemented Interfaces:
Map<String,Object>

public final class ConfigurationParameters extends Object implements Map<String,Object>
ConfigurationParameters is a convenience class that allows typed access to configuration properties. It implements the Map interface but is immutable.
  • Field Details

  • Method Details

    • of

      @NotNull public static @NotNull ConfigurationParameters of(@NotNull @NotNull ConfigurationParameters... params)
      Creates a new configuration parameters instance by merging all params sequentially. I.e. property define in subsequent arguments overwrite the ones before.
      Parameters:
      params - source parameters to merge
      Returns:
      merged configuration parameters or EMPTY if all source params were empty.
    • of

      @NotNull public static @NotNull ConfigurationParameters of(@NotNull @NotNull Properties properties)
      Creates new a configuration parameters instance by copying the given properties.
      Parameters:
      properties - source properties
      Returns:
      configuration parameters or EMPTY if the source properties were empty.
    • of

      @NotNull public static @NotNull ConfigurationParameters of(@NotNull @NotNull Dictionary<String,Object> properties)
      Creates new a configuration parameters instance by copying the given properties.
      Parameters:
      properties - source properties
      Returns:
      configuration parameters or EMPTY if the source properties were empty.
    • of

      @NotNull public static @NotNull ConfigurationParameters of(@NotNull @NotNull Map<?,?> map)
      Creates new a configuration parameters instance by copying the given map.
      Parameters:
      map - source map
      Returns:
      configuration parameters or EMPTY if the source map was empty.
    • of

      @NotNull public static @NotNull ConfigurationParameters of(@NotNull @NotNull String key, @NotNull @NotNull Object value)
      Creates new a single valued configuration parameters instance from the given key and value.
      Parameters:
      key - The key
      value - The value
      Returns:
      a new instance of configuration parameters.
    • of

      @NotNull public static @NotNull ConfigurationParameters of(@NotNull @NotNull String key1, @NotNull @NotNull Object value1, @NotNull @NotNull String key2, @NotNull @NotNull Object value2)
      Creates new a configuration parameters instance from the given key and value pairs.
      Parameters:
      key1 - The key of the first pair.
      value1 - The value of the first pair
      key2 - The key of the second pair.
      value2 - The value of the second pair.
      Returns:
      a new instance of configuration parameters.
    • contains

      public boolean contains(@NotNull @NotNull String key)
      Returns true if this instance contains a configuration entry with the specified key irrespective of the defined value; false otherwise.
      Parameters:
      key - The key to be tested.
      Returns:
      true if this instance contains a configuration entry with the specified key irrespective of the defined value; false otherwise.
    • getConfigValue

      @Nullable public <T> T getConfigValue(@NotNull @NotNull String key, @Nullable T defaultValue, @Nullable @Nullable Class<T> targetClass)
      Returns the value of the configuration entry with the given key applying the following rules:
      • If this instance doesn't contain a configuration entry with that key the specified defaultValue will be returned.
      • If defaultValue is null the original value will be returned.
      • If the configured value is null this method will always return null.
      • If neither defaultValue nor the configured value is null an attempt is made to convert the configured value to match the type of the default value.
      Parameters:
      key - The name of the configuration option.
      defaultValue - The default value to return if no such entry exists or to use for conversion.
      targetClass - The target class
      Returns:
      The original or converted configuration value or null.
    • getConfigValue

      @NotNull public <T> T getConfigValue(@NotNull @NotNull String key, @NotNull T defaultValue)
      Returns the value of the configuration entry with the given key applying the following rules:
      • If this instance doesn't contain a configuration entry with that key, or if the entry is null, the specified defaultValue will be returned.
      • If the configured value is not null an attempt is made to convert the configured value to match the type of the default value.
      Parameters:
      key - The name of the configuration option.
      defaultValue - The default value to return if no such entry exists or to use for conversion.
      Returns:
      The original or converted configuration value or defaultValue if no entry for the given key exists.
    • size

      public int size()
      Specified by:
      size in interface Map<String,Object>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<String,Object>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<String,Object>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<String,Object>
    • get

      public Object get(Object key)
      Specified by:
      get in interface Map<String,Object>
    • put

      public Object put(String key, Object value)
      Specified by:
      put in interface Map<String,Object>
    • remove

      public Object remove(Object key)
      Specified by:
      remove in interface Map<String,Object>
    • putAll

      public void putAll(@NotNull @NotNull Map<? extends String,?> m)
      Specified by:
      putAll in interface Map<String,Object>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<String,Object>
    • keySet

      @NotNull public @NotNull Set<String> keySet()
      Specified by:
      keySet in interface Map<String,Object>
    • values

      @NotNull public @NotNull Collection<Object> values()
      Specified by:
      values in interface Map<String,Object>
    • entrySet

      @NotNull public @NotNull Set<Map.Entry<String,Object>> entrySet()
      Specified by:
      entrySet in interface Map<String,Object>