public class Setting<T> extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected Function<Settings,String> |
defaultValue |
| 构造器和说明 |
|---|
Setting(Key key,
Function<Settings,String> defaultValue,
Setting<T> fallbackSetting,
Function<String,T> parser,
Validator<T> validator)
LineLength.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
exists(Settings settings)
Returns true if and only if this setting is present in the given settings instance.
|
boolean |
existsOrFallbackExists(Settings settings)
Returns true if and only if this setting including fallback settings
is present in the given settings instance.
|
T |
get(Settings settings)
Returns the settings value.
|
T |
getDefault(Settings settings)
Returns the default value for this setting.
|
String |
getDefaultRaw(Settings settings)
Returns the default value string representation for this setting.
|
String |
getKey()
Returns the settings key or a prefix if this setting is a group setting.
|
String |
getRaw(Settings settings) |
Key |
getRawKey()
Returns the original representation of a setting key.
|
boolean |
match(String toTest)
Returns
true iff the given key matches the settings key or if this setting is a group setting if the
given key is part of the settings group. |
SettingUpdater<T> |
newUpdater(Consumer<T> updater,
Consumer<T> validator,
Logger logger) |
public final String getKey()
Settings object.
Use get(Settings) insteadisGroupSetting()public final Key getRawKey()
public T get(Settings settings)
public T getDefault(Settings settings)
settings - a settings object for settings that has a default value depending on another setting if availablepublic String getDefaultRaw(Settings settings)
settings - a settings object for settings that has a default value depending on another setting if availablepublic boolean exists(Settings settings)
settings - the settingspublic boolean existsOrFallbackExists(Settings settings)
settings - the settingspublic final boolean match(String toTest)
true iff the given key matches the settings key or if this setting is a group setting if the
given key is part of the settings group.isGroupSetting()Copyright © 2021. All rights reserved.