Class SettingUtils
java.lang.Object
net.solarnetwork.settings.support.SettingUtils
Helper utilities for settings.
- Since:
- 1.43
- Version:
- 1.1
- Author:
- matt
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAPI to map a list element into a set ofSettingSpecifierobjects. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> BasicGroupSettingSpecifierdynamicListSettingSpecifier(String key, Collection<T> collection, SettingUtils.KeyedListCallback<T> mapper) Get a dynamic listGroupSettingSpecifier.keyedSettingDefaults(List<SettingSpecifier> settings) Extract allKeyedSettingSpecifierkeys and associated default values from a list of settings.static List<SettingSpecifier>mappedWithPrefix(List<SettingSpecifier> settings, String prefix) Add a prefix to the keys of allMappableSpecifiersettings.secureKeys(List<SettingSpecifier> settings) Get a set of setting keys that require secure handling.
-
Method Details
-
dynamicListSettingSpecifier
public static <T> BasicGroupSettingSpecifier dynamicListSettingSpecifier(String key, Collection<T> collection, SettingUtils.KeyedListCallback<T> mapper) Get a dynamic listGroupSettingSpecifier.- Type Parameters:
T- the group item type- Parameters:
key- the group setting keycollection- The collection to turn into settings.mapper- A helper to map individual elements into settings.- Returns:
- The resulting
GroupSettingSpecifier.
-
secureKeys
Get a set of setting keys that require secure handling.This method considers the following settings for secure handling :
TextFieldSettingSpecifier.isSecureTextEntry()that returns true
The returned set maintains the same iteration order as
settings.- Parameters:
settings- the settings to check (null allowed)- Returns:
- the set of secure entry keys, never null
-
mappedWithPrefix
public static List<SettingSpecifier> mappedWithPrefix(List<SettingSpecifier> settings, String prefix) Add a prefix to the keys of allMappableSpecifiersettings.- Parameters:
settings- the settings to mapprefix- the prefix to add to allMappableSpecifiersettings- Returns:
- list of mapped settings, or null if
settingsis null - Since:
- 1.1
-
keyedSettingDefaults
Extract allKeyedSettingSpecifierkeys and associated default values from a list of settings.Both
GroupSettingSpecifier.getGroupSettings()andParentSettingSpecifier.getChildSettings()will be included in the returned map.- Parameters:
settings- the settings to extract the keyed defaults from- Returns:
- a map of keyed setting keys to associated default values, never null
- Since:
- 1.1
-