-
- Type Parameters:
S- storage typeV- value type
- All Superinterfaces:
Defaultable<V>,DefaultGetter<S,V>,DefaultSetter<S,V>,Getter<S,V>,Setter<S,V>,Value<S,V>
- All Known Subinterfaces:
DefaultAdaptedKeyValue<S,K,O,V>,DefaultAdaptedValue<S,O,V>,DefaultKeyValue<S,K,V>
public interface DefaultValue<S,V> extends DefaultGetter<S,V>, DefaultSetter<S,V>, Value<S,V>
A value associated with a default fallback.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static <S,V>
DefaultValue<S,V>of(V def, Value<S,V> value)Creates a newDefaultValueby delegating to the provided arguments.default voidsetAsDefault(S storage)Sets the value in storage to the default value.default voidsetAsDefaultIfUnset(S storage)Sets the value in storage to the default value if there isn't already an existing value yet.-
Methods inherited from interface com.rezzedup.util.valuables.Defaultable
getDefaultValue
-
Methods inherited from interface com.rezzedup.util.valuables.DefaultGetter
getOrDefault
-
-
-
-
Method Detail
-
of
static <S,V> DefaultValue<S,V> of(V def, Value<S,V> value)
Creates a newDefaultValueby delegating to the provided arguments.- Type Parameters:
S- storage typeV- value type- Parameters:
def- the default fallback valuevalue- an existing value implementation- Returns:
- a new instance composed of the arguments
-
setAsDefault
default void setAsDefault(S storage)
Description copied from interface:DefaultSetterSets the value in storage to the default value.- Specified by:
setAsDefaultin interfaceDefaultSetter<S,V>- Parameters:
storage- the storage
-
setAsDefaultIfUnset
default void setAsDefaultIfUnset(S storage)
Description copied from interface:DefaultSetterSets the value in storage to the default value if there isn't already an existing value yet.- Specified by:
setAsDefaultIfUnsetin interfaceDefaultSetter<S,V>- Parameters:
storage- the storage
-
-