Package org.refcodes.tabular
Class ColumnImpl<T>
- java.lang.Object
-
- org.refcodes.tabular.AbstractColumn<T>
-
- org.refcodes.tabular.ColumnImpl<T>
-
- Type Parameters:
T- The type managed by theColumn.
- All Implemented Interfaces:
java.lang.Cloneable,org.refcodes.mixin.KeyAccessor<java.lang.String>,org.refcodes.mixin.TypeAccessor<T>,Column<T>
public class ColumnImpl<T> extends AbstractColumn<T> implements java.lang.Cloneable
Implementation of aColumnsupportingObjectinstances, beingCloneable. The storageStringinstance is converted from and back using serialization; the serialized byte arrays are converted using base64 encoding to aString.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.KeyAccessor
org.refcodes.mixin.KeyAccessor.KeyBuilder<K extends java.lang.Object,B extends org.refcodes.mixin.KeyAccessor.KeyBuilder<K,B>>, org.refcodes.mixin.KeyAccessor.KeyMutator<K extends java.lang.Object>, org.refcodes.mixin.KeyAccessor.KeyProperty<K extends java.lang.Object>
-
-
Constructor Summary
Constructors Constructor Description ColumnImpl(java.lang.String aKey, java.lang.Class<T> aType)Creates aColumnImplmanagingStringinstances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()TfromStorageStrings(java.lang.String[] aStringValues)From storage strings.java.lang.String[]toStorageStrings(T aValue)AColumnimplementation can provide its own text exchange format for the given objects.-
Methods inherited from class org.refcodes.tabular.AbstractColumn
contains, fromStorageString, get, getKey, getType, remove, toPrintable, toStorageString
-
-
-
-
Constructor Detail
-
ColumnImpl
public ColumnImpl(java.lang.String aKey, java.lang.Class<T> aType)Creates aColumnImplmanagingStringinstances.- Parameters:
aKey- The key for theColumnImpl.aType- The type to be used.
-
-
Method Detail
-
toStorageStrings
public java.lang.String[] toStorageStrings(T aValue)
AColumnimplementation can provide its own text exchange format for the given objects. This method enables theColumnto convert a value of the given type to aStringarray and viaColumn.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 storageStringrepresentations of the elements in that array may be placed in dedicated entries of the returnedStringarray. In case T is not an array type then the returnedStringarray 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 methodColumn.toStorageString(Object)may be used instead.- Specified by:
toStorageStringsin interfaceColumn<T>- Parameters:
aValue- the element to be converted to aStringarray.- Returns:
- The
Stringarray representation of the value.
-
fromStorageStrings
public T fromStorageStrings(java.lang.String[] aStringValues) throws java.text.ParseException
From storage strings.- Specified by:
fromStorageStringsin interfaceColumn<T>- Parameters:
aStringValues- the string values- Returns:
- the t
- Throws:
java.text.ParseException- the parse exception
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classAbstractColumn<T>- Throws:
java.lang.CloneNotSupportedException
-
-