Class Properties

java.lang.Object
org.javagi.gobject.types.Properties

@NullMarked public class Properties extends Object
Helper class to register properties in a new GType.
  • Constructor Details

    • Properties

      public Properties()
  • Method Details

    • setProperty

      public static void setProperty(GObject gobject, String propertyName, @Nullable Object propertyValue)
      Set a property of an object.
      Parameters:
      propertyName - the name of the property to set
      propertyValue - the new property propertyValue
      Throws:
      IllegalArgumentException - if a property with this name is not found for the object
    • getProperty

      public static @Nullable Object getProperty(GObject gobject, String propertyName)
      Get a property of an object.
      Parameters:
      gobject - the object instance
      propertyName - the name of the property to get
      Returns:
      the property value
      Throws:
      IllegalArgumentException - if a property with this name is not found for the object
    • installProperties

      public @Nullable Consumer<TypeClass> installProperties(Class<?> cls)
      If the provided class defines @Property-annotated getter and/or setter methods, this function will return a class initializer that registers these properties as GObject properties and overrides the GObject.getProperty and setProperty methods to call the annotated getters and setters.
      Parameters:
      cls - the class that possibly contains @Property annotations
      Returns:
      a class initializer that registers the properties