uk.ac.starlink.hapi

## Interface HapiParam

-     public interface HapiParam

  Characterises a HAPI Parameter, that is the metadata for a column in a HAPI dataset.
  Since:
    11 Jan 2024
  See Also:
    HAPI 3.1, sec 3.6.6

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static HapiParam` | `fromJson(org.json.JSONObject json)` Reads HapiParam from a HAPI Parameter JSON object.
    `HapiBins[]` | `getBins()` Returns an array of bins objects for this parameter.
    `java.lang.String` | `getDescription()` Returns a description of this parameter.
    `java.lang.String` | `getFill()` Returns a string representation of the fill value for this parameter.
    `java.lang.String[]` | `getLabel()` Returns the labels for this parameter.
    `int` | `getLength()` Returns the length of this parameter.
    `java.lang.String` | `getName()` Returns the parameter name.
    `int[]` | `getSize()` Returns the size attribute of this parameter.
    `HapiType<?,?>` | `getType()` Returns the parameter data type.
    `java.lang.String[]` | `getUnits()` Returns the units for this parameter.
    `static java.lang.String[]` | `stringOrArray(java.lang.Object json)` Interprets an object which may be either a String or a JSONArray as an array of strings.

- - ### Method Detail

    - #### getName

          java.lang.String getName()

      Returns the parameter name.
      Returns:
        name

    - #### getType

          HapiType<?,?> getType()

      Returns the parameter data type.
      Returns:
        type

    - #### getLength

          int getLength()

      Returns the length of this parameter. This is non-negative for data types `HapiType.STRING` and `HapiType.ISOTIME`, and -1 for numeric types.
      Returns:
        string length or -1

    - #### getSize

          int[] getSize()

      Returns the size attribute of this parameter. This is an array giving dimensions of an array parameter, or null for a scalar parameter. Array indices are C-like (last index varies fastest).
      Returns:
        array shape or null

    - #### getUnits

          java.lang.String[] getUnits()

      Returns the units for this parameter. If present it should have a length of either 1 or the array element count.
      Returns:
        units array or null

    - #### getLabel

          java.lang.String[] getLabel()

      Returns the labels for this parameter. If present it should have a length of either 1 or the array element count.
      Returns:
        labels array or null

    - #### getFill

          java.lang.String getFill()

      Returns a string representation of the fill value for this parameter.
      Returns:
        fill string or null

    - #### getDescription

          java.lang.String getDescription()

      Returns a description of this parameter.
      Returns:
        description or null

    - #### getBins

          HapiBins[] getBins()

      Returns an array of bins objects for this parameter. If not null, there should be one per dimension.
      Returns:
        array of bins objects describing dimensions, or null

    - #### fromJson

          static HapiParam fromJson(org.json.JSONObject json)

      Reads HapiParam from a HAPI Parameter JSON object.
      Parameters:
        `json` - JSON object
      Returns:
        param object, not null

    - #### stringOrArray

          static java.lang.String[] stringOrArray(java.lang.Object json)

      Interprets an object which may be either a String or a JSONArray as an array of strings. If it's a String, the result is a one-element array.

      This method should be private, but Java 8, unlike Java 9+, does not permit private static methods on interfaces.

      Parameters:
        `json` - object assumed to be read from JSON
      Returns:
        array of strings or null