Package org.javagi.gobject.types
Class Overrides
java.lang.Object
org.javagi.gobject.types.Overrides
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MemorySegment
lookupVirtualMethod
(MemorySegment address, MemoryLayout classLayout, String name) Returns a function pointer to the specified virtual method.static MemorySegment
lookupVirtualMethod
(MemorySegment address, MemoryLayout classLayout, String name, Type ifaceType) Returns a function pointer to the specified virtual method.static MemorySegment
lookupVirtualMethodParent
(MemorySegment address, MemoryLayout layout, String name) Returns a function pointer to the specified virtual method.static MemorySegment
lookupVirtualMethodParent
(MemorySegment address, MemoryLayout layout, String name, Type ifaceType) Returns a function pointer to the specified virtual method.static <T extends TypeInstance,
TC extends TypeClass>
Consumer<TypeClass> overrideClassMethods
(Class<?> cls) Find declared methods that override methods defined in a GObject type class, and return a class initializer lambda that will register the method overrides in the class virtual function table.
-
Constructor Details
-
Overrides
public Overrides()
-
-
Method Details
-
overrideClassMethods
public static <T extends TypeInstance,TC extends TypeClass> Consumer<TypeClass> overrideClassMethods(Class<?> cls) Find declared methods that override methods defined in a GObject type class, and return a class initializer lambda that will register the method overrides in the class virtual function table.- Parameters:
cls
- the class that possibly declares method overrides- Returns:
- a lambda to run during class initialization that will register the virtual functions
-
lookupVirtualMethod
public static MemorySegment lookupVirtualMethod(MemorySegment address, MemoryLayout classLayout, String name) Returns a function pointer to the specified virtual method. The pointer is retrieved from the TypeClass.- Parameters:
address
- the memory address of the object instanceclassLayout
- the memory layout of the object's TypeClassname
- the name of the virtual method (as defined in the TypeClass)- Returns:
- a function pointer to the requested virtual method
-
lookupVirtualMethodParent
public static MemorySegment lookupVirtualMethodParent(MemorySegment address, MemoryLayout layout, String name) Returns a function pointer to the specified virtual method. The pointer is retrieved from the TypeClass of the parent class of the instance.- Parameters:
address
- the memory address of the object instancelayout
- the memory layout of the object's TypeClassname
- the name of the virtual method (as defined in the TypeClass)- Returns:
- a function pointer to the requested virtual method
-
lookupVirtualMethod
public static MemorySegment lookupVirtualMethod(MemorySegment address, MemoryLayout classLayout, String name, Type ifaceType) Returns a function pointer to the specified virtual method. The pointer is retrieved from the TypeInterface with the specified GType.- Parameters:
address
- the memory address of the object instanceclassLayout
- the memory layout of the object's TypeClassname
- the name of the virtual method (as defined in the TypeInterface)ifaceType
- the GType of the interface that declares the virtual method- Returns:
- a function pointer to the requested virtual method
-
lookupVirtualMethodParent
public static MemorySegment lookupVirtualMethodParent(MemorySegment address, MemoryLayout layout, String name, Type ifaceType) Returns a function pointer to the specified virtual method. The pointer is retrieved from the TypeInterface with the specified GType, implemented by the parent class of the instance.- Parameters:
address
- the memory address of the object instancelayout
- the memory layout of the parent object's TypeClassname
- the name of the virtual method (as defined in the TypeInterface)ifaceType
- the GType of the interface that declares the virtual method- Returns:
- a function pointer to the requested virtual method
-