com.azalient.api.file.record
Class TypeObject

java.lang.Object
  extended by com.azalient.api.file.record.TypeObject
Direct Known Subclasses:
ReaderUtilities

public class TypeObject
extends Object

All the methods in this class are static, but including it at the base of the class hierarchy allows us to use the methods without referencing a static class. This makes the code a bit neater.


Constructor Summary
TypeObject()
           
 
Method Summary
static boolean b(Object data)
          Convert a data object to an integer value, null translates to false.
static NamedColour c(Object data)
          Convert a data object to a NamedColour.
static double d(Object data)
          Convert a data object to a double value, null translates to zero.
static boolean equals(Object key, String s)
           
static boolean equals(String key, String s)
           
static boolean equalsEW(Object key, String s)
           
static float f(Object data)
          Convert a data object to a float value, null translates to zero.
static int i(Object data)
          Convert a data object to an integer value, null translates to zero.
static String keyString(Object[] keys)
           
static String keyString(Table table, RecordW record)
           
static String nameFromKeyString(String keyString)
           
static Object[] rowKeysFromKeyString(String keyString)
           
static String s(Object data)
          Convert a data object to a String, using toString().
static UTime t(Object data)
          Convert a data object to a UTime object, using format HHMMSS
static UTime t(Object data, UTime.Format format)
          Convert a data object to a UTime object, using a supplied format, or HHMMSS if none.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeObject

public TypeObject()
Method Detail

d

public static double d(Object data)
Convert a data object to a double value, null translates to zero. Accepted types are String or java.lang.Number (Double, Float, Integer, etc). All other types return 0.


f

public static float f(Object data)
Convert a data object to a float value, null translates to zero. Accepted types are String or java.lang.Number (Double, Float, Integer, etc). All other types return 0.


i

public static int i(Object data)
Convert a data object to an integer value, null translates to zero. Accepted types are String or java.lang.Number (Double, Float, Integer, etc). All other types return 0.


b

public static boolean b(Object data)
Convert a data object to an integer value, null translates to false. Accepted types are Boolean, Number (non-zero = true) or String ("y", "yes", or "true" = true ). All other types return 0.


s

public static String s(Object data)
Convert a data object to a String, using toString(). A zero length string will return null. If the data is a number, a little formatting is done, to remove trailing zeroes


t

public static UTime t(Object data)
Convert a data object to a UTime object, using format HHMMSS


t

public static UTime t(Object data,
                      UTime.Format format)
Convert a data object to a UTime object, using a supplied format, or HHMMSS if none. Null returns a time of zero. Accepted types are Number or String, with number being interpreted as seconds, String is parsed by UTime.

See Also:
UTime

c

public static NamedColour c(Object data)
Convert a data object to a NamedColour. Accepted types are java.awt.Color, NamedColour or String, where the string is converted to a colour using the NamedColour parsing method


equals

public static boolean equals(Object key,
                             String s)

equals

public static boolean equals(String key,
                             String s)

equalsEW

public static boolean equalsEW(Object key,
                               String s)

keyString

public static String keyString(Object[] keys)

rowKeysFromKeyString

public static Object[] rowKeysFromKeyString(String keyString)

nameFromKeyString

public static String nameFromKeyString(String keyString)

keyString

public static String keyString(Table table,
                               RecordW record)