T - The type of value this class holdspublic interface ConfigLeaf<T> extends ConfigNode, Property<T>, Commentable
ConfigNode with some value of type T.ConfigNode,
ConfigLeafBuilder| Modifier and Type | Method and Description |
|---|---|
default boolean |
accepts(T rawValue)
Returns
true if this property can be set to the given raw value. |
void |
addChangeListener(BiConsumer<T,T> listener) |
SerializableType<T> |
getConfigType() |
T |
getDefaultValue()
Returns the default value for this item.
|
BiConsumer<T,T> |
getListener()
Returns the listener for this item.
|
default Class<? super T> |
getType()
Returns the class of the type of the value being held.
|
T |
getValue()
Returns this
ConfigLeaf's current value. |
boolean |
setValue(T value)
Sets the value held by this
ConfigLeaf. |
attachTo, detach, getAttributes, getAttributeValue, getAttributeValue, getName, getOrCreateAttribute, getParentgetCommentboolean setValue(@Nonnull T value)
ConfigLeaf.
If the provided value does not satisfy this setting's type constraints:
true. false. setValue in interface Property<T>value - the new value this ConfigLeaf should holdtrue if this property changed as a result of the call, and false otherwise.accepts(Object)default boolean accepts(@Nonnull T rawValue)
true if this property can be set to the given raw value.
This method does not account for possible corrections offered by the type's constraints.
In other words, it returns true if and only if every constraint of this property's
config type accepts the given value as is.
accepts in interface Property<T>rawValue - the value to checktrue if this property accepts the given value, false otherwise.SerializableType.accepts(Object)@Nonnull T getValue()
ConfigLeaf's current value.
If no successful call to setValue(Object) has been made,
this method returns this node's default value.
SerializableType<T> getConfigType()
default Class<? super T> getType()
HasValue@Nonnull BiConsumer<T,T> getListener()
When this item's value changes, the consumer will be called with the old value as first argument and the new value as second argument.
void addChangeListener(BiConsumer<T,T> listener)