Klasse PropertyConverter

java.lang.Object
com.dua3.utility.fx.PropertyConverter

public class PropertyConverter extends Object
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
    Konstruktor
    Beschreibung
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static <A, B, P extends Property<A>>
    Property<B>
    convert(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.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Konstruktordetails

    • PropertyConverter

      public PropertyConverter()
  • Methodendetails

    • convert

      public static <A, B, P extends Property<A>> Property<B> convert(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 value
      B - the type of the converted property's value
      P - the type of Property containing the original value
      Parameter:
      property - the original property whose value is to be converted
      converter - 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, 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. The conversion is automatically applied whenever the original property's value changes.
      Typparameter:
      A - the type of the value held by the input property
      B - the type of the value to be held by the output read-only property
      V - the type of ObservableValue containing the original value
      Parameter:
      value - the property whose value is to be converted
      converter - 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, 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. The conversion is automatically applied whenever the original property's value changes.
      Typparameter:
      A - the type of the value held by the input property
      B - the type of the value to be held by the output read-only property
      V - the type of ObservableValue containing the original value
      Parameter:
      value - the property whose value is to be converted
      converter - 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