java.lang.Object
com.dua3.utility.fx.PropertyConverter
A utility class for converting properties between different types while maintaining
synchronization between the original and converted properties. It provides methods
to convert a property to a different type and to create read-only properties with
conversions applied.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungconvert(P property, com.dua3.utility.data.Converter<A, B> converter) Converts a property of one type to another type using the provided converter, maintaining bidirectional synchronization between the original and converted properties.static <A,B, V extends ObservableValue<A>>
ReadOnlyProperty<B> convertReadOnly(V value, com.dua3.utility.data.Converter<A, B> converter) Converts a given read/write property of type A to a read-only property of type B using the specified converter.static <A,B, V extends ObservableValue<A>>
ReadOnlyProperty<B> convertReadOnly(V value, Function<A, B> converter) Converts a given read/write property of type A to a read-only property of type B using the specified converter.
-
Konstruktordetails
-
PropertyConverter
public PropertyConverter()
-
-
Methodendetails
-
convert
public static <A,B, Property<B> convertP extends Property<A>> (P property, com.dua3.utility.data.Converter<A, B> converter) Converts a property of one type to another type using the provided converter, maintaining bidirectional synchronization between the original and converted properties.Note: both properties must not be bound!
- Typparameter:
A- the type of the original property's valueB- the type of the converted property's valueP- the type of Property containing the original value- Parameter:
property- the original property whose value is to be convertedconverter- a converter that defines how to convert the property's value from type A to type B and vice versa- Gibt zurück:
- a new Property with a value of type B, synchronized with the original property
-
convertReadOnly
public static <A,B, ReadOnlyProperty<B> convertReadOnlyV extends ObservableValue<A>> (V value, com.dua3.utility.data.Converter<A, B> converter) Converts a given read/write property of type A to a read-only property of type B using the specified converter. The conversion is automatically applied whenever the original property's value changes.- Typparameter:
A- the type of the value held by the input propertyB- the type of the value to be held by the output read-only propertyV- the type of ObservableValue containing the original value- Parameter:
value- the property whose value is to be convertedconverter- the converter used to convert the property's value from type A to type B- Gibt zurück:
- a read-only property containing the converted value of type B
-
convertReadOnly
public static <A,B, ReadOnlyProperty<B> convertReadOnlyV extends ObservableValue<A>> (V value, Function<A, B> converter) Converts a given read/write property of type A to a read-only property of type B using the specified converter. The conversion is automatically applied whenever the original property's value changes.- Typparameter:
A- the type of the value held by the input propertyB- the type of the value to be held by the output read-only propertyV- the type of ObservableValue containing the original value- Parameter:
value- the property whose value is to be convertedconverter- the converter used to convert the property's value from type A to type B- Gibt zurück:
- a read-only property containing the converted value of type B
-