Package uk.ac.starlink.topcat.join
Class ValueCodec
java.lang.Object
uk.ac.starlink.topcat.join.ValueCodec
Encodes and decodes values for a ValueInfo between different
string representations.
- Since:
- 7 Sep 2004
- Author:
- Mark Taylor (Starlink)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract String
formatValue
(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 Object
unformatString
(String text) Decodes a string to give a value in the context of this codec.
-
Constructor Details
-
ValueCodec
public ValueCodec()
-
-
Method Details
-
unformatString
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
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 objectmaxLength
- maximum number of characters in the returned string- Returns:
- string representation of value
-
getCodecs
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
-