Class PanamaGlobalType

java.lang.Object
ai.tegmentum.wasmtime4j.panama.type.PanamaGlobalType
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.type.GlobalType, ai.tegmentum.wasmtime4j.type.WasmType

public final class PanamaGlobalType extends Object implements ai.tegmentum.wasmtime4j.type.GlobalType
Panama implementation of GlobalType interface.

This class provides type introspection capabilities for WebAssembly global types using Panama Foreign Function Interface bindings to the native Wasmtime library.

Since:
1.0.0
  • Constructor Details

    • PanamaGlobalType

      public PanamaGlobalType(ai.tegmentum.wasmtime4j.WasmValueType valueType, boolean isMutable, Arena arena, MemorySegment nativeHandle)
      Creates a new PanamaGlobalType instance.
      Parameters:
      valueType - the value type of the global
      isMutable - true if the global is mutable, false if immutable
      arena - the memory arena for resource management
      nativeHandle - the native handle to the global type
  • Method Details

    • of

      public static PanamaGlobalType of(ai.tegmentum.wasmtime4j.WasmValueType valueType, boolean isMutable)
      Creates a PanamaGlobalType from type information without a native handle.

      This factory method is used when type information is parsed from JSON or other sources where a native handle is not available.

      Parameters:
      valueType - the value type of the global
      isMutable - true if the global is mutable, false if immutable
      Returns:
      the PanamaGlobalType instance
    • fromNative

      public static PanamaGlobalType fromNative(MemorySegment nativeHandle, Arena arena)
      Creates a PanamaGlobalType from native global type information.
      Parameters:
      nativeHandle - the native handle to the global type
      arena - the memory arena for resource management
      Returns:
      the PanamaGlobalType instance
      Throws:
      IllegalArgumentException - if nativeHandle is invalid
    • getValueType

      public ai.tegmentum.wasmtime4j.WasmValueType getValueType()
      Specified by:
      getValueType in interface ai.tegmentum.wasmtime4j.type.GlobalType
    • isMutable

      public boolean isMutable()
      Specified by:
      isMutable in interface ai.tegmentum.wasmtime4j.type.GlobalType
    • getKind

      public ai.tegmentum.wasmtime4j.type.WasmTypeKind getKind()
      Specified by:
      getKind in interface ai.tegmentum.wasmtime4j.type.GlobalType
      Specified by:
      getKind in interface ai.tegmentum.wasmtime4j.type.WasmType
    • getNativeHandle

      public MemorySegment getNativeHandle()
      Gets the native handle for this global type.
      Returns:
      the native handle
    • getArena

      public Arena getArena()
      Gets the memory arena used by this global type.
      Returns:
      the memory arena
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object