Class PanamaTableType

java.lang.Object
ai.tegmentum.wasmtime4j.panama.type.PanamaTableType
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.type.TableType, ai.tegmentum.wasmtime4j.type.WasmType

public final class PanamaTableType extends Object implements ai.tegmentum.wasmtime4j.type.TableType
Panama implementation of TableType interface.

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

Since:
1.0.0
  • Constructor Details

    • PanamaTableType

      public PanamaTableType(ai.tegmentum.wasmtime4j.WasmValueType elementType, long minimum, Long maximum, Arena arena, MemorySegment nativeHandle)
      Creates a new PanamaTableType instance.
      Parameters:
      elementType - the element type stored in the table
      minimum - the minimum number of elements
      maximum - the maximum number of elements (null if unlimited)
      arena - the memory arena for resource management
      nativeHandle - the native handle to the table type
    • PanamaTableType

      public PanamaTableType(ai.tegmentum.wasmtime4j.WasmValueType elementType, long minimum, Long maximum, boolean is64, Arena arena, MemorySegment nativeHandle)
      Creates a new PanamaTableType instance with 64-bit index support.
      Parameters:
      elementType - the element type stored in the table
      minimum - the minimum number of elements
      maximum - the maximum number of elements (null if unlimited)
      is64 - true if this table uses 64-bit indices
      arena - the memory arena for resource management
      nativeHandle - the native handle to the table type
  • Method Details

    • of

      public static PanamaTableType of(ai.tegmentum.wasmtime4j.WasmValueType elementType, long minimum, Long maximum)
      Creates a PanamaTableType 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:
      elementType - the element type stored in the table
      minimum - the minimum number of elements
      maximum - the maximum number of elements (null if unlimited)
      Returns:
      the PanamaTableType instance
    • fromNative

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

      public ai.tegmentum.wasmtime4j.WasmValueType getElementType()
      Specified by:
      getElementType in interface ai.tegmentum.wasmtime4j.type.TableType
    • getMinimum

      public long getMinimum()
      Specified by:
      getMinimum in interface ai.tegmentum.wasmtime4j.type.TableType
    • getMaximum

      public Optional<Long> getMaximum()
      Specified by:
      getMaximum in interface ai.tegmentum.wasmtime4j.type.TableType
    • is64Bit

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

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

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

      public Arena getArena()
      Gets the memory arena used by this table 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