public final class Settings extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static SettingsBuilder |
builder()
Returns a builder to be used in order to build settings.
|
boolean |
equals(Object o) |
Settings |
filter(Predicate<String> predicate)
Returns a new settings object that contains all setting of the current one
filtered by the given settings key predicate.
|
String |
get(String setting)
Returns the setting value associated with the setting key.
|
String |
get(String setting,
String defaultValue)
Returns the setting value associated with the setting key.
|
Boolean |
getAsBoolean(String setting,
Boolean defaultValue)
Returns the setting value (as boolean) associated with the setting key.
|
Double |
getAsDouble(String setting,
Double defaultValue)
Returns the setting value (as double) associated with the setting key.
|
Float |
getAsFloat(String setting,
Float defaultValue)
Returns the setting value (as float) associated with the setting key.
|
Map<String,Settings> |
getAsGroups()
Returns group settings for the given setting prefix.
|
Integer |
getAsInt(String setting,
Integer defaultValue)
Returns the setting value (as int) associated with the setting key.
|
List<String> |
getAsList(String key)
The values associated with a setting key as an immutable list.
|
List<String> |
getAsList(String key,
List<String> defaultValue)
The values associated with a setting key as an immutable list.
|
List<String> |
getAsList(String key,
List<String> defaultValue,
Boolean commaDelimited)
The values associated with a setting key as an immutable list.
|
Long |
getAsLong(String setting,
Long defaultValue)
Returns the setting value (as long) associated with the setting key.
|
Settings |
getAsSettings(String setting)
Returns the settings mapped to the given setting name.
|
Settings |
getByPrefix(String prefix)
A settings that are filtered (and key is removed) with the specified prefix.
|
Map<String,Settings> |
getGroups(String settingPrefix)
Returns group settings for the given setting prefix.
|
Map<String,Settings> |
getGroups(String settingPrefix,
boolean ignoreNonGrouped)
Returns group settings for the given setting prefix.
|
int |
hashCode() |
boolean |
hasValue(String key)
Returns
true iff the given key has a value in this settings object. |
boolean |
isEmpty()
Returns
true if this settings object contains no settings. |
Set<String> |
keySet()
Returns the fully qualified setting names contained in this settings object.
|
Set<String> |
names() |
int |
size()
Returns the number of settings in this settings object.
|
public boolean isEmpty()
true if this settings object contains no settings.true if this settings object contains no settingspublic int size()
public Set<String> keySet()
public boolean hasValue(String key)
true iff the given key has a value in this settings object.public String get(String setting)
setting - The setting keynull if it does not exists.public String get(String setting, String defaultValue)
public Settings getByPrefix(String prefix)
public Settings getAsSettings(String setting)
public Settings filter(Predicate<String> predicate)
public Float getAsFloat(String setting, Float defaultValue)
public Double getAsDouble(String setting, Double defaultValue)
public Integer getAsInt(String setting, Integer defaultValue)
public Long getAsLong(String setting, Long defaultValue)
public Boolean getAsBoolean(String setting, Boolean defaultValue)
public List<String> getAsList(String key) throws SettingsException
key - The setting key to load the list bySettingsExceptionpublic List<String> getAsList(String key, List<String> defaultValue) throws SettingsException
key - The setting key to load the list bySettingsExceptionpublic List<String> getAsList(String key, List<String> defaultValue, Boolean commaDelimited) throws SettingsException
key - The setting key to load the list bydefaultValue - The default value to use if no value is specifiedcommaDelimited - Whether to try to parse a string as a comma-delimited valueSettingsExceptionpublic Map<String,Settings> getAsGroups() throws SettingsException
public Map<String,Settings> getGroups(String settingPrefix) throws SettingsException
public Map<String,Settings> getGroups(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException
public static SettingsBuilder builder()
Copyright © 2021. All rights reserved.