Package org.javagi.gobject.types
Class Properties
java.lang.Object
org.javagi.gobject.types.Properties
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Functional interface declaration of theGetPropertyCallback
callback.static interface
Functional interface declaration of theSetPropertyCallback
callback. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getProperty
(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.getProperty
andsetProperty
methods to call the annotated getters and setters.static Type
readPropertyValueType
(GObject.ObjectClass objectClass, String propertyName) Read the value type from the GParamSpec of a GObject property.static void
setProperty
(GObject gobject, String propertyName, Object propertyValue) Set a property of an object.
-
Constructor Details
-
Properties
public Properties()
-
-
Method Details
-
readPropertyValueType
Read the value type from the GParamSpec of a GObject property.- Parameters:
objectClass
- the GObject typeclass that has a property installed with the provided namepropertyName
- the name of the property- Returns:
- the value type of the GParamSpec of the GObject property, or null if not found
-
setProperty
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.getProperty
andsetProperty
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
-