Class ObjectColumn<T>

java.lang.Object
org.refcodes.tabular.AbstractColumn<T>
org.refcodes.tabular.ObjectColumn<T>
Type Parameters:
T - The type managed by the Column.
All Implemented Interfaces:
Cloneable, org.refcodes.mixin.KeyAccessor<String>, org.refcodes.mixin.TypeAccessor<T>, Column<T>

public class ObjectColumn<T> extends AbstractColumn<T> implements Cloneable
Implementation of a Column supporting Object instances, being Cloneable. The storage String instance is converted from and back using serialization; the serialized byte arrays are converted using base64 encoding to a String.
  • Constructor Details

  • Method Details

    • toStorageStrings

      public String[] toStorageStrings(T aValue)
      A Column implementation can provide its own text exchange format for the given objects. This method enables the Column to convert a value of the given type to a String array and via Column.fromStorageStrings(String[]) back to the value (bijective). This method supports data sinks (such as Amazon's SimpleDb) which provide dedicated support for multiple values in a row's entry: In case T is an array type, then the storage String representations of the elements in that array may be placed in dedicated entries of the returned String array. In case T is not an array type then the returned String array may contain just one value. In case data sinks (such as relational databases) are to be addressed which allow only a single value in a row's entry, then the method Column.toStorageString(Object) may be used instead.
      Specified by:
      toStorageStrings in interface Column<T>
      Parameters:
      aValue - the element to be converted to a String array.
      Returns:
      The String array representation of the value.
    • fromStorageStrings

      public T fromStorageStrings(String[] aStringValues) throws ParseException
      From storage strings.
      Specified by:
      fromStorageStrings in interface Column<T>
      Parameters:
      aStringValues - the string values
      Returns:
      the t
      Throws:
      ParseException - the parse exception
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class AbstractColumn<T>
      Throws:
      CloneNotSupportedException