CLinker.VaList.Builder (Java SE 17 & JDK 17)
Description: declaration: module: jdk.incubator.foreign, package: jdk.incubator.foreign, interface: CLinker, interface: VaList, interface: Builder
Keywords: jdk.incubator.foreign.CLinker.VaList.Builder interface

Module jdk.incubator.foreign
Package jdk.incubator.foreign

# Interface CLinker.VaList.Builder

Enclosing interface:
  CLinker.VaList

public static sealed interface CLinker.VaList.Builder
A builder interface used to construct a C `va_list`.

Unless otherwise specified, passing a `null` argument, or an array argument containing one or more `null` elements to a method in this class causes a `NullPointerException` to be thrown.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CLinker.VaList.Builder`
  `vargFromAddress(ValueLayout layout, Addressable value)`
  Adds a native value represented as a `MemoryAddress` to the C `va_list` being constructed.
  `CLinker.VaList.Builder`
  `vargFromDouble(ValueLayout layout, double value)`
  Adds a native value represented as a `double` to the C `va_list` being constructed.
  `CLinker.VaList.Builder`
  `vargFromInt(ValueLayout layout, int value)`
  Adds a native value represented as an `int` to the C `va_list` being constructed.
  `CLinker.VaList.Builder`
  `vargFromLong(ValueLayout layout, long value)`
  Adds a native value represented as a `long` to the C `va_list` being constructed.
  `CLinker.VaList.Builder`
  `vargFromSegment(GroupLayout layout, MemorySegment value)`
  Adds a native value represented as a `MemorySegment` to the C `va_list` being constructed.

- ## Method Details

  - ### vargFromInt

    CLinker.VaList.Builder vargFromInt(ValueLayout layout, int value)
    Adds a native value represented as an `int` to the C `va_list` being constructed.
    Parameters:
      `layout` - the native layout of the value.
      `value` - the value, represented as an `int`.
    Returns:
      this builder.
    Throws:
      `IllegalArgumentException` - if the given memory layout is not compatible with `int`

  - ### vargFromLong

    CLinker.VaList.Builder vargFromLong(ValueLayout layout, long value)
    Adds a native value represented as a `long` to the C `va_list` being constructed.
    Parameters:
      `layout` - the native layout of the value.
      `value` - the value, represented as a `long`.
    Returns:
      this builder.
    Throws:
      `IllegalArgumentException` - if the given memory layout is not compatible with `long`

  - ### vargFromDouble

    CLinker.VaList.Builder vargFromDouble(ValueLayout layout, double value)
    Adds a native value represented as a `double` to the C `va_list` being constructed.
    Parameters:
      `layout` - the native layout of the value.
      `value` - the value, represented as a `double`.
    Returns:
      this builder.
    Throws:
      `IllegalArgumentException` - if the given memory layout is not compatible with `double`

  - ### vargFromAddress

    CLinker.VaList.Builder vargFromAddress(ValueLayout layout, Addressable value)
    Adds a native value represented as a `MemoryAddress` to the C `va_list` being constructed.
    Parameters:
      `layout` - the native layout of the value.
      `value` - the value, represented as a `Addressable`.
    Returns:
      this builder.
    Throws:
      `IllegalArgumentException` - if the given memory layout is not compatible with `MemoryAddress`

  - ### vargFromSegment

    CLinker.VaList.Builder vargFromSegment(GroupLayout layout, MemorySegment value)
    Adds a native value represented as a `MemorySegment` to the C `va_list` being constructed.
    Parameters:
      `layout` - the native layout of the value.
      `value` - the value, represented as a `MemorySegment`.
    Returns:
      this builder.
    Throws:
      `IllegalArgumentException` - if the given memory layout is not compatible with `MemorySegment`