| Modifier | Constructor and Description |
|---|---|
protected |
Setting(String identifier,
Class<V> valueType,
V defaultValue)
Constructs a new setting with the specified identifier, value type, and default value.
|
protected |
Setting(String identifier,
V defaultValue)
Constructs a new setting with the specified identifier and default value.
|
| Modifier and Type | Method and Description |
|---|---|
<S extends Setting<?>> |
as(S setting) |
protected void |
checkValue(V newValue)
Subclasses may override this method to check that new values for this setting are valid.
|
protected Object |
clone() |
static Setting<Boolean> |
create(String identifier,
Boolean defaultValue)
Convenience method to create a new setting with the specified identifier and default value.
|
static <V> Setting<V> |
create(String identifier,
Class<V> valueType,
V defaultValue)
Convenience method to create a new setting with the specified identifier,
value type, and default value.
|
static Setting<Double> |
create(String identifier,
Double defaultValue)
Convenience method to create a new setting with the specified identifier and default value.
|
static Setting<Float> |
create(String identifier,
Float defaultValue)
Convenience method to create a new setting with the specified identifier and default value.
|
static Setting<Integer> |
create(String identifier,
Integer defaultValue)
Convenience method to create a new setting with the specified identifier and default value.
|
static Setting<Long> |
create(String identifier,
Long defaultValue)
Convenience method to create a new setting with the specified identifier and default value.
|
static Setting<String> |
create(String identifier,
String defaultValue)
Convenience method to create a new setting with the specified identifier and default value.
|
boolean |
equals(Object o) |
String |
getIdentifier() |
V |
getValue() |
Type |
getValueType() |
int |
hashCode() |
String |
toString() |
Setting<V> |
withValue(V newValue) |
protected Setting(String identifier, V defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier or any of the type arguments were invalidprotected Setting(String identifier, Class<V> valueType, V defaultValue)
identifier - the identifier for this settingvalueType - the value type for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalid, or
the value type is primitive, mutable, or has type parameterspublic final String getIdentifier()
protected void checkValue(V newValue) throws Exception
NullPointerException if the
new value is null and the original default value for this setting was non-null.newValue - the new value for this settingException - if the new value for this setting is invalidpublic final V getValue()
public final Type getValueType()
public final <S extends Setting<?>> Optional<S> as(S setting)
public final Setting<V> withValue(V newValue)
Setting object with this setting's key and the supplied value.IllegalArgumentException - if the new value was invalid, as determined by:
this.checkValue(newValue)
checkValue(Object)public final boolean equals(Object o)
public static Setting<Boolean> create(String identifier, Boolean defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalidpublic static Setting<String> create(String identifier, String defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalidpublic static Setting<Integer> create(String identifier, Integer defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalidpublic static Setting<Long> create(String identifier, Long defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalidpublic static Setting<Float> create(String identifier, Float defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalidpublic static Setting<Double> create(String identifier, Double defaultValue)
identifier - the identifier for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalidpublic static <V> Setting<V> create(String identifier, Class<V> valueType, V defaultValue)
identifier - the identifier for this settingvalueType - the value type for this settingdefaultValue - the default value for this settingIllegalArgumentException - if the identifier is invalid, or
the value type is primitive, mutable, or has type parametersCopyright © 2010–2019 The Apache Software Foundation. All rights reserved.