Package uk.ac.starlink.topcat.join

## Class ValueCodec

- java.lang.Object
- - uk.ac.starlink.topcat.join.ValueCodec

-     public abstract class ValueCodec
      extends java.lang.Object

  Encodes and decodes values for a ValueInfo between different string representations.
  Since:
    7 Sep 2004
  Author:
    Mark Taylor (Starlink)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ValueCodec()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract java.lang.String` | `formatValue​(java.lang.Object value, int maxLength)` | Returns a string representation of a given value in the context of this codec.
    `static ValueCodec[]` | `getCodecs​(uk.ac.starlink.table.ValueInfo info)` | Returns an array of ValueCodec objects suitable for representing the values pertaining to a given `ValueInfo` object.
    `abstract java.lang.Object` | `unformatString​(java.lang.String text)` | Decodes a string to give a value in the context of this codec.

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

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

- - ### Constructor Detail

    - #### ValueCodec

          public ValueCodec()

  - ### Method Detail

    - #### unformatString

          public abstract java.lang.Object unformatString​(java.lang.String text)

      Decodes a string to give a value in the context of this codec.
      Parameters:
        `text` - string representation of the value
      Returns:
        value object as read from `text`

    - #### formatValue

          public abstract java.lang.String formatValue​(java.lang.Object value,
                                                       int maxLength)

      Returns a string representation of a given value in the context of this codec. The returned string should be no longer than a given maximum length.
      Parameters:
        `value` - value object
        `maxLength` - maximum number of characters in the returned string
      Returns:
        string representation of `value`

    - #### getCodecs

          public static ValueCodec[] getCodecs​(uk.ac.starlink.table.ValueInfo info)

      Returns an array of ValueCodec objects suitable for representing the values pertaining to a given `ValueInfo` object. The returned array will contain at least one element, which just gets its implementation from the behaviour of the submitted ValueInfo itself, but it may contain more than this, for instance ones relating to different units.
      Parameters:
        `info` - description of the value to represent
      Returns:
        array of value codecs for `info`, containing at least one element