uk.ac.starlink.gbin

## Class GbinMetadataReader

- java.lang.Object
- - uk.ac.starlink.gbin.GbinMetadataReader

-     public class GbinMetadataReader
      extends java.lang.Object

  Provides methods for extracting metadata from a GBIN file.
  Since:
    13 Aug 2014

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static GbinMeta` | `attemptReadMetadata(java.lang.Object gbinReaderObj)` Attempts to read a metadata object from a GbinReader object.
    `static java.lang.String` | `convertNameToArchiveFormat(java.lang.String gbinName)` Converts a java-type name to an archive-type (SQL-friendly) name.
    `static java.lang.String` | `getGaiaTableName(java.lang.Class<?> objClazz)` Returns the "official" table name for a GBIN file containing objects of a given class.
    `static GaiaTableMetadata` | `getTableMetadata(java.lang.String gaiaTableName)` Returns a metadata object containing information about an "official" known Gaia table.
    `static void` | `main(java.lang.String[] args)` Attempts to read metadata from the GBIN file named on the command line and writes the description to stdout.

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

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

- - ### Method Detail

    - #### attemptReadMetadata

          public static GbinMeta attemptReadMetadata(java.lang.Object gbinReaderObj)
                                              throws java.lang.Throwable

      Attempts to read a metadata object from a GbinReader object.

      NOTE: this method is effectively destructive: if you read metadata from a GbinReader you cannot then go on to read data records from it.

      A wide range of exceptions and errors may be thrown by this method, since it involves reflection all sorts of things can go wrong.

      Parameters:
        `gbinReaderObj` - object implementing `gaia.cu1.tools.dal.gbin.GbinReader`
      Returns:
        metadata if possible
      Throws:
        `java.lang.Throwable`

    - #### getGaiaTableName

          public static java.lang.String getGaiaTableName(java.lang.Class<?> objClazz)

      Returns the "official" table name for a GBIN file containing objects of a given class.
      Parameters:
        `objClazz` - class of the objects that form the records of a GBIN file
      Returns:
        gaia table name, or null if not known
      See Also:
        `getTableMetadata(java.lang.String)`

    - #### convertNameToArchiveFormat

          public static java.lang.String convertNameToArchiveFormat(java.lang.String gbinName)

      Converts a java-type name to an archive-type (SQL-friendly) name.
      Parameters:
        `gbinName` - java-type name
      Returns:
        archive-type name

    - #### getTableMetadata

          public static GaiaTableMetadata getTableMetadata(java.lang.String gaiaTableName)

      Returns a metadata object containing information about an "official" known Gaia table. The table name may be obtained by calling `getGaiaTableName(java.lang.Class<?>)`. The returned metadata is extracted from datamodel classes on the classpath, by an instance of `gaia.cu9.tools.documentationexport.MetadataReader`.
      Parameters:
        `gaiaTableName` - "official" gaia table name
      Returns:
        metadata object, or null if table name not known

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Throwable

      Attempts to read metadata from the GBIN file named on the command line and writes the description to stdout.
      Throws:
        `java.lang.Throwable`