Class BindingBuilder<S,T>

java.lang.Object
org.javagi.gobject.BindingBuilder<S,T>
Type Parameters:
S - type of the source property
T - type of the target property

@NullMarked public class BindingBuilder<S,T> extends Object
Builder class to setup a GObject property binding.
See Also:
  • Constructor Details

    • BindingBuilder

      public BindingBuilder()
      Create a BindingBuilder to construct a GObject property binding.
      See Also:
    • BindingBuilder

      public BindingBuilder(GObject source, String sourceProperty, GObject target, String targetProperty)
      Create a BindingBuilder to construct a GObject property binding.
      Parameters:
      source - the source GObject
      sourceProperty - the property on the source object to bind
      target - the target GObject
      targetProperty - the property on target to bind
      See Also:
  • Method Details

    • source

      public BindingBuilder<S,T> source(GObject sourceObject)
      Set the source GObject
    • sourceProperty

      public BindingBuilder<S,T> sourceProperty(String sourceProperty)
      Set the property on the source object to bind
    • target

      public BindingBuilder<S,T> target(GObject targetObject)
      Set the target GObject
    • targetProperty

      public BindingBuilder<S,T> targetProperty(String targetProperty)
      the property on target to bind
    • bidirectional

      public BindingBuilder<S,T> bidirectional()
      Bidirectional binding; if either the property of the source or the property of the target changes, the other is updated.
    • syncCreate

      public BindingBuilder<S,T> syncCreate()
      Synchronize the values of the source and target properties when creating the binding; the direction of the synchronization is always from the source to the target.
    • invertBoolean

      public BindingBuilder<S,T> invertBoolean()
      If the two properties being bound are booleans, setting one to true will result in the other being set to false and vice versa. This flag will only work for boolean properties, and cannot be used when passing custom transformation functions.
    • transformTo

      public BindingBuilder<S,T> transformTo(@Nullable Function<S,T> transformTo)
      Set the transformation function from this GObject to the target, or null to use the default.
    • transformFrom

      public BindingBuilder<S,T> transformFrom(@Nullable Function<T,S> transformFrom)
      Set the transformation function from the target to this GObject, or null to use the default
    • build

      public Binding build()
      Create the property binding.