Class BoxedUtil

java.lang.Object
org.javagi.gobject.BoxedUtil

@NullMarked public class BoxedUtil extends Object
Utility functions for boxed types
  • Constructor Details

    • BoxedUtil

      public BoxedUtil()
  • Method Details

    • isBoxed

      public static boolean isBoxed(Type type)
      Checks if type is a boxed type.
      Parameters:
      type - A Type value
      Returns:
      true if type is a boxed type
    • copy

      public static <T extends @Nullable Proxy> @Nullable MemorySegment copy(@Nullable Type type, T struct, long size)
      Make a copy of struct. If type is a boxed type, use g_boxed_copy, or else, malloc a new struct and copy size bytes from struct to it.
      Parameters:
      type - the type, possibly a boxed type
      struct - the struct to be copied
      size - the size of the struct (only used when type is not a boxed type)
      Returns:
      the newly created copy of struct. The caller has ownership and is responsible for freeing it.
    • free

      public static <T extends @Nullable Proxy> void free(@Nullable Type type, T struct, @Nullable Consumer<T> freeFunc)
      Free struct. If type is a boxed type, use g_boxed_free, or else, apply freeFunc on struct.
      Parameters:
      type - the type, possibly a boxed type
      struct - the struct to be freed
      freeFunc - a function that will free struct (only used when type is not a boxed type)