-
public final class MappedPreferenceKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any, V extends Any> Preference<V>map(Preference<T> $self, Function1<T, V> from, Function1<V, T> to)Creates a new Preference object wrapping the receiver and converting its value from and to the target type V. final static <T extends Any, V extends Any> EnumPreference<V>map(EnumPreference<T> $self, Function1<T, V> from, Function1<V, T> to, Function1<List<T>, List<V>> supportedValues)Creates a new EnumPreference object wrapping the receiver and converting its value and supportedValues, from and to the target type V. final static <T extends Comparable<T>, V extends Comparable<V>> RangePreference<V>map(RangePreference<T> $self, Function1<T, V> from, Function1<V, T> to, Function1<ClosedRange<T>, ClosedRange<V>> supportedRange, Function1<V, String> formatValue, Function1<RangePreference<V>, Unit> increment, Function1<RangePreference<V>, Unit> decrement)Creates a new RangePreference object wrapping the receiver and converting its value and supportedRange, from and to the target type V. final static <T extends Comparable<T>> RangePreference<T>map(RangePreference<T> $self, Function1<ClosedRange<T>, ClosedRange<T>> supportedRange, Function1<T, String> formatValue, Function1<RangePreference<T>, Unit> increment, Function1<RangePreference<T>, Unit> decrement)Creates a new RangePreference object wrapping the receiver and transforming its supportedRange, or overwriting its formatValue or increment and decrement strategy. final static <T extends Any> EnumPreference<T>withSupportedValues(Preference<T> $self, T supportedValues)Creates a new EnumPreference object wrapping the receiver with the provided supportedValues. final static <T extends Any> EnumPreference<T>withSupportedValues(Preference<T> $self, List<T> supportedValues)Creates a new EnumPreference object wrapping the receiver with the provided supportedValues. final static <T extends Any> EnumPreference<T>withSupportedValues(EnumPreference<T> $self, T supportedValues)Creates a new EnumPreference object wrapping the receiver with the provided supportedValues. final static <T extends Any> EnumPreference<T>withSupportedValues(EnumPreference<T> $self, List<T> supportedValues)Creates a new EnumPreference object wrapping the receiver with the provided supportedValues. final static <T extends Any> EnumPreference<T>mapSupportedValues(EnumPreference<T> $self, Function1<List<T>, List<T>> transform)Creates a new EnumPreference object wrapping the receiver and transforming its supported values with transform. final static <T extends Comparable<T>> RangePreference<T>withSupportedRange(RangePreference<T> $self, ClosedRange<T> range, ProgressionStrategy<T> progressionStrategy)Creates a new RangePreference object wrapping the receiver and using a different supported range. -
-
Method Detail
-
map
final static <T extends Any, V extends Any> Preference<V> map(Preference<T> $self, Function1<T, V> from, Function1<V, T> to)
Creates a new Preference object wrapping the receiver and converting its value from and to the target type V.
-
map
final static <T extends Any, V extends Any> EnumPreference<V> map(EnumPreference<T> $self, Function1<T, V> from, Function1<V, T> to, Function1<List<T>, List<V>> supportedValues)
Creates a new EnumPreference object wrapping the receiver and converting its value and supportedValues, from and to the target type V.
-
map
final static <T extends Comparable<T>, V extends Comparable<V>> RangePreference<V> map(RangePreference<T> $self, Function1<T, V> from, Function1<V, T> to, Function1<ClosedRange<T>, ClosedRange<V>> supportedRange, Function1<V, String> formatValue, Function1<RangePreference<V>, Unit> increment, Function1<RangePreference<V>, Unit> decrement)
Creates a new RangePreference object wrapping the receiver and converting its value and supportedRange, from and to the target type V.
The value formatter, or increment and decrement strategy of the receiver can be overwritten.
-
map
final static <T extends Comparable<T>> RangePreference<T> map(RangePreference<T> $self, Function1<ClosedRange<T>, ClosedRange<T>> supportedRange, Function1<T, String> formatValue, Function1<RangePreference<T>, Unit> increment, Function1<RangePreference<T>, Unit> decrement)
Creates a new RangePreference object wrapping the receiver and transforming its supportedRange, or overwriting its formatValue or increment and decrement strategy.
-
withSupportedValues
final static <T extends Any> EnumPreference<T> withSupportedValues(Preference<T> $self, T supportedValues)
Creates a new EnumPreference object wrapping the receiver with the provided supportedValues.
-
withSupportedValues
final static <T extends Any> EnumPreference<T> withSupportedValues(Preference<T> $self, List<T> supportedValues)
Creates a new EnumPreference object wrapping the receiver with the provided supportedValues.
-
withSupportedValues
final static <T extends Any> EnumPreference<T> withSupportedValues(EnumPreference<T> $self, T supportedValues)
Creates a new EnumPreference object wrapping the receiver with the provided supportedValues.
-
withSupportedValues
final static <T extends Any> EnumPreference<T> withSupportedValues(EnumPreference<T> $self, List<T> supportedValues)
Creates a new EnumPreference object wrapping the receiver with the provided supportedValues.
-
mapSupportedValues
final static <T extends Any> EnumPreference<T> mapSupportedValues(EnumPreference<T> $self, Function1<List<T>, List<T>> transform)
Creates a new EnumPreference object wrapping the receiver and transforming its supported values with transform.
-
withSupportedRange
final static <T extends Comparable<T>> RangePreference<T> withSupportedRange(RangePreference<T> $self, ClosedRange<T> range, ProgressionStrategy<T> progressionStrategy)
Creates a new RangePreference object wrapping the receiver and using a different supported range. A new progressionStrategy can be provided to customize the implementation of increment and decrement.
-
-
-
-