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

# Record Class CachedInfoResponse

java.lang.Object
java.lang.Record
org.firebirdsql.gds.ng.CachedInfoResponse

Record Components:
  `infoResponse` - byte array with info response; the caller of the constructor is responsible for cloning/copying the array if needed

@NullMarked public record CachedInfoResponse(byte[] infoResponse) extends Record
Cached info response.

This record holds an info response array, and can produce a filtered response holding only those items asked for.

Since:
  6.0.2
Author:
  Mark Rotteveel

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CachedInfoResponse(byte[] infoResponse)`
  Creates an instance of a `CachedInfoResponse` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CachedInfoResponse`
  `empty()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `byte[]`
  `filtered(byte[] requestItems)`
  Produces a response with only the items in `requestItems`, allowing items to be missing.
  `Optional<byte[]>`
  `filteredComplete(byte[] requestItems)`
  Produces a response with only the items in `requestItems`, requiring all items to be present.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `byte[]`
  `infoResponse()`
  Returns the value of the `infoResponse` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### CachedInfoResponse

    public CachedInfoResponse(byte[] infoResponse)
    Creates an instance of a `CachedInfoResponse` record class.
    Parameters:
      `infoResponse` - the value for the `infoResponse` record component

- ## Method Details

  - ### empty

    public static CachedInfoResponse empty()
    Returns:
      a — possibly cached — empty cached info response

  - ### filtered

    public byte[] filtered(byte[] requestItems)
    Produces a response with only the items in `requestItems`, allowing items to be missing.

    If there are no matching items, or the cached response is empty, then a byte array with only `ISCConstants.isc_info_end` is returned.

    Parameters:
      `requestItems` - requested info items
    Returns:
      an info response with only the requested items, ending in `ISCConstants.isc_info_end`
    See Also:
      - `filteredComplete(byte[])`

  - ### filteredComplete

    public Optional<byte[]> filteredComplete(byte[] requestItems)
    Produces a response with only the items in `requestItems`, requiring all items to be present.

    If at least one item in `requestItems` (excluding `ISCConstants.isc_info_end`) is not found in this cached info response, empty is returned.

    Parameters:
      `requestItems` - requested info items
    Returns:
      an optional with an info response with only the requested items, and ending in `ISCConstants.isc_info_end`, or empty if at least one of the requested items where not found in the cached response, or if the cached response is empty
    See Also:
      - `filtered(byte[])`

  - ### infoResponse

    public byte[] infoResponse()
    Returns the value of the `infoResponse` record component.
    Returns:
      the value of the `infoResponse` record component

  - ### hashCode

    public int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public boolean equals(Object obj)
    Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with `Objects::equals(Object,Object)`.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `obj` - the object with which to compare
    Returns:
      `true` if this object is the same as the `obj` argument; `false` otherwise.

  - ### toString

    public final String toString()
    Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object