Interface TypeClassCacheFunc

All Superinterfaces:
FunctionPointer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @Generated("org.javagi.JavaGI") public interface TypeClassCacheFunc extends FunctionPointer

Functional interface declaration of the TypeClassCacheFunc callback.

See Also:
  • Method Details

    • run

      boolean run(@Nullable MemorySegment cacheData, TypeClass gClass)

      A callback function which is called when the reference count of a class drops to zero.

      It may use g_type_class_ref() to prevent the class from being freed. You should not call g_type_class_unref() from a GTypeClassCacheFunc function to prevent infinite recursion, use g_type_class_unref_uncached() instead.

      The functions have to check the class id passed in to figure whether they actually want to cache the class of this type, since all classes are routed through the same GTypeClassCacheFunc chain.

      Parameters:
      cacheData - data that was given to the g_type_add_class_cache_func() call
      gClass - The GTypeClass structure which is unreferenced
      Returns:
      true to stop further GTypeClassCacheFuncs from being called, false to continue
    • upcall

      default int upcall(MemorySegment cacheData, MemorySegment gClass)
      The upcall method is called from native code. The parameters are marshaled and run(MemorySegment, TypeClass) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer