Module org.firebirdsql.jaybird
Package org.firebirdsql.gds

# Interface Parameter

All Known Implementing Classes:
  `Argument`, `BigIntArgument`, `ByteArgument`, `ByteArrayArgument`, `NumericArgument`, `SingleItem`, `StringArgument`, `TypedArgument`

public interface Parameter
Interface for parameters stored in a `ParameterBuffer`.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `copyTo(ParameterBuffer buffer, Encoding stringEncoding)`
  Copies this argument into the supplied buffer, uses the supplied `Encoding` for string arguments.
  `int`
  `getType()`
  The type identifier of the parameter (usually one of the constant values in `ISCConstants`).
  `int`
  `getValueAsInt()`
  The value of the parameter as int.
  `long`
  `getValueAsLong()`
  The value of the parameter as long.
  `String`
  `getValueAsString()`
  The value of the parameter as String.

- ## Method Details

  - ### getType

    int getType()
    The type identifier of the parameter (usually one of the constant values in `ISCConstants`).
    Returns:
      The type of the parameter

  - ### getValueAsString

    String getValueAsString()
    The value of the parameter as String.

    The implementation may throw a RuntimeException if the parameter isn't a string (or shouldn't be used as a string).

    Returns:
      The value as string

  - ### getValueAsInt

    int getValueAsInt()
    The value of the parameter as int.

    The implementation may throw a RuntimeException if the parameter isn't an int (or shouldn't be used as an int).

    Returns:
      The value as int

  - ### getValueAsLong

    long getValueAsLong()
    The value of the parameter as long.

    The implementation may throw a RuntimeException if the parameter isn't a long (or shouldn't be used as a long).

    Returns:
      The value as long

  - ### copyTo

    void copyTo(ParameterBuffer buffer, Encoding stringEncoding)
    Copies this argument into the supplied buffer, uses the supplied `Encoding` for string arguments.

    An instance of `Parameter` should know how to copy itself into another buffer (eg an instance of `StringArgument` would know to call `ParameterBuffer.addArgument(int, String, Encoding)`).

    The parameter does not need to check if it is the right type of destination buffer (if someone tries to add a TPB argument to a DPB they are free to try that).

    Parameters:
      `buffer` - ParameterBuffer instance
      `stringEncoding` - Encoding to use for string properties. A value of `null` can be used to signal that the original encoding should be used.