Package uk.ac.starlink.vo

## Class SiaFormatOption

- java.lang.Object
- - uk.ac.starlink.vo.SiaFormatOption

-     public class SiaFormatOption
      extends java.lang.Object

  Encapsulates options for record format requirements used in an SIA query.

  This is a bit of a historical relic: in SIAv1 FORMAT was one of the most important options, but in SIAv2 there are many options and FORMAT doesn't necessarily warrant special treatment. This is here to enable pluggability between SIAv1 and v2 without disruption to the UI, but it may be replaced with a more comprehensive upgrade to SIAv2 handling in future.

  Since:
    12 Mar 2020
  Author:
    Mark Taylor

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static SiaFormatOption` | `ALL` |
    `static SiaFormatOption` | `DATALINK` |
    `static SiaFormatOption` | `FITS` |
    `static SiaFormatOption` | `GRAPHIC` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SiaFormatOption​(java.lang.String value)` | Constructs an option instance with a single value, suitable for both SIAv1 and SIAv2.
    `SiaFormatOption​(java.lang.String v1Value, java.lang.String[] v2Values)` | Constructs a general format option.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SiaFormatOption` | `fromObject​(java.lang.Object formatOrString)` | Tries to turn an object into an SiaFormatObject.
    `java.lang.String` | `getSiav1Value()` | Returns value for use in SIAv1 queries.
    `java.lang.String[]` | `getSiav2Values()` | Returns list of values for use in SIAv2 queries.
    `static SiaFormatOption[]` | `getStandardOptions()` | Returns a list of standard options suitable for use in an SIA UI.
    `java.lang.String` | `toString()` |

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

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

- - ### Field Detail

    - #### ALL

          public static final SiaFormatOption ALL

    - #### GRAPHIC

          public static final SiaFormatOption GRAPHIC

    - #### FITS

          public static final SiaFormatOption FITS

    - #### DATALINK

          public static final SiaFormatOption DATALINK

  - ### Constructor Detail

    - #### SiaFormatOption

          public SiaFormatOption​(java.lang.String value)

      Constructs an option instance with a single value, suitable for both SIAv1 and SIAv2.
      Parameters:
        `value` - required FORMAT parameter value

    - #### SiaFormatOption

          public SiaFormatOption​(java.lang.String v1Value,
                                 java.lang.String[] v2Values)

      Constructs a general format option.
      Parameters:
        `v1Value` - value for use in SIAv1 queries
        `v2Values` - list of values to be ORed together for SIAv2 queries

  - ### Method Detail

    - #### getSiav1Value

          public java.lang.String getSiav1Value()

      Returns value for use in SIAv1 queries.
      Returns:
        SIAv1 FORMAT parameter value

    - #### getSiav2Values

          public java.lang.String[] getSiav2Values()

      Returns list of values for use in SIAv2 queries.
      Returns:
        list of values for repeated SIAv2 FORMAT parameters

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getStandardOptions

          public static SiaFormatOption[] getStandardOptions()

      Returns a list of standard options suitable for use in an SIA UI.
      Returns:
        standard format options

    - #### fromObject

          public static SiaFormatOption fromObject​(java.lang.Object formatOrString)

      Tries to turn an object into an SiaFormatObject. The input object may already be an SiaFormatObject or may be a String. This method is intended for use with an editable JComboBox containing SiaFormatOption objects.
      Parameters:
        `formatOrString` - object that may represent an SiaFormatObject, either an SiaFormatObject or a FORMAT value
      Returns:
        corresponding SiaFormatObject, or null