Record Class ViewMixin.Converter<V>

java.lang.Object
java.lang.Record
ch.ladestation.connectncharge.util.mvcbase.ViewMixin.Converter<V>
Enclosing interface:
ViewMixin<M,C extends ControllerBase<M>>

public static record ViewMixin.Converter<V>(ObservableValue<V> observableValue) extends Record
  • Constructor Details

    • Converter

      public Converter(ObservableValue<V> observableValue)
      Creates an instance of a Converter record class.
      Parameters:
      observableValue - the value for the observableValue record component
  • Method Details

    • convertedBy

      public <R> ViewMixin.Updater<V,R> convertedBy(Function<V,R> converter)
      Second (optional) step for registering an observer to specify a converter-function
      Type Parameters:
      R -
      Parameters:
      converter - the function converting the type of 'ObservableValue' into the type of the 'Property'
      Returns:
      an Updater to specify the 'GUI-Property' that needs to be updated if 'ObservableValue' changes
    • update

      public void update(javafx.beans.property.Property<? super V> property)
      Registers an observer without any type conversion that will keep property-value and observableValue in sync.
      Parameters:
      property - GUI-Property that will be updated when observableValue changes
    • execute

      public void execute(ObservableValue.ValueChangeListener<V> listener)
      Registers an observer.
      Parameters:
      listener - whatever needs to be done on GUI when observableValue changes
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • observableValue

      public ObservableValue<V> observableValue()
      Returns the value of the observableValue record component.
      Returns:
      the value of the observableValue record component