Package org.gnome.gobject
Class TypeInstance
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
Bitmask,DoubleRange,Event,Expression,FlagSet,Fraction,FractionRange,GObject,Int64Range,IntRange,ParamSpec,RenderNode,ValueArray,ValueList
An opaque structure used as the base of all type instances.
-
Constructor Summary
ConstructorsConstructorDescriptionAllocate a new TypeInstance.TypeInstance(Arena arena) Allocate a new TypeInstance.TypeInstance(MemorySegment address) Create a TypeInstance proxy instance for the provided memory address.TypeInstance(TypeClass gClass) Allocate a new TypeInstance with the fields set to the provided values.TypeInstance(TypeClass gClass, Arena arena) Allocate a new TypeInstance with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the flag that determines if for virtual method calls,g_type_class_peek_parent()is used to obtain the function pointer of the parent type instead of the instance class.protected voidcallParent(boolean callParent) Set the flag that determines if for virtual method calls,g_type_class_peek_parent()is used to obtain the function pointer of the parent type instead of the instance class.<T extends TypeInstance>
TCast this instance to the requested type, if the GTypes are compatible.static MemoryLayoutThe memory layout of the native struct.@Nullable MemorySegmentgetPrivate(Type privateType) Read the value of the fieldg_class.voidwriteGClass(TypeClass gClass) Write a value in the fieldg_class.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TypeInstance
Create a TypeInstance proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
TypeInstance
Allocate a new TypeInstance.- Parameters:
arena- to control the memory allocation scope
-
TypeInstance
public TypeInstance()Allocate a new TypeInstance. The memory is allocated withArena.ofAuto(). -
TypeInstance
-
TypeInstance
Allocate a new TypeInstance with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
gClass- value for the fieldgClass
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readGClass
Read the value of the fieldg_class.- Returns:
- The value of the field
g_class
-
writeGClass
Write a value in the fieldg_class.- Parameters:
gClass- The new value for the fieldg_class
-
getPrivate
-
callParent
protected void callParent(boolean callParent) Set the flag that determines if for virtual method calls,g_type_class_peek_parent()is used to obtain the function pointer of the parent type instead of the instance class.- Parameters:
callParent- true to call the parent vfunc instead of an overridden vfunc
-
callParent
public boolean callParent()Returns the flag that determines if for virtual method calls,g_type_class_peek_parent()is used to obtain the function pointer of the parent type instead of the instance class.- Returns:
- true when parent vfunc is called instead of an overridden vfunc, or false when the overridden vfunc of the instance is called.
-
cast
Cast this instance to the requested type, if the GTypes are compatible.- Type Parameters:
T- the type of the intended class (must be a GTypeInstance)- Parameters:
to- the intended class- Returns:
- a new instance of the requested class
- Throws:
IllegalArgumentException- whentois not a registered GTypeClassCastException- when the GType of this instance does not derive from the GType ofto
-