Package org.javagi.gobject.types
Class Properties
java.lang.Object
org.javagi.gobject.types.Properties
Helper class to register properties in a new GType.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theGetPropertyCallbackcallback.static interfaceFunctional interface declaration of theSetPropertyCallbackcallback. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ObjectgetProperty(GObject gobject, String propertyName) Get a property of an object.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 theGObject.getPropertyandsetPropertymethods to call the annotated getters and setters.static voidsetProperty(GObject gobject, String propertyName, @Nullable Object propertyValue) Set a property of an object.
-
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 setpropertyValue- the new property propertyValue- Throws:
IllegalArgumentException- if a property with this name is not found for the object
-
getProperty
Get a property of an object.- Parameters:
gobject- the object instancepropertyName- 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
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 theGObject.getPropertyandsetPropertymethods to call the annotated getters and setters.- Parameters:
cls- the class that possibly contains @Property annotations- Returns:
- a class initializer that registers the properties
-