Interface Column<T>
- Type Parameters:
T- The type managed by theColumn.
- All Superinterfaces:
org.refcodes.mixin.KeyAccessor<String>,org.refcodes.mixin.TypeAccessor<T>
- All Known Implementing Classes:
AbstractColumn,BooleanColumn,DateColumn,DoubleColumn,EnumColumn,ExceptionColumn,FloatColumn,FormattedColumn,IntColumn,LongColumn,ObjectColumn,StringColumn,StringsColumn
public interface Column<T>
extends org.refcodes.mixin.KeyAccessor<String>, org.refcodes.mixin.TypeAccessor<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.KeyAccessor
org.refcodes.mixin.KeyAccessor.KeyBuilder<K,B extends org.refcodes.mixin.KeyAccessor.KeyBuilder<K, B>>, org.refcodes.mixin.KeyAccessor.KeyMutator<K>, org.refcodes.mixin.KeyAccessor.KeyProperty<K> Nested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor
org.refcodes.mixin.TypeAccessor.TypeBuilder<T,B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T, B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T>, org.refcodes.mixin.TypeAccessor.TypeProperty<T> -
Method Summary
Modifier and TypeMethodDescriptionbooleanfromStorageString(String aStringValue) AColumnimplementation can provide its own text exchange format for the given objects.fromStorageStrings(String[] aStringArray) AColumnimplementation can provide its own text exchange format for the given objects.default TRetrieves the corresponding value from the provided record.toPrintable(T aValue) AColumnimplementation can provide its own printable format of the given objects; for example a human readable text representation of the value (or in very https://www.metacodes.proized cases even enriched with ANSI escape codes).toStorageString(T aValue) AColumnimplementation can provide its own text exchange format for the given objects.default StringtoStorageString_(Object aValue) AColumnimplementation can provide its own text exchange format for the given objects.String[]toStorageStrings(T aValue) AColumnimplementation can provide its own text exchange format for the given objects.Methods inherited from interface org.refcodes.mixin.KeyAccessor
getKeyMethods inherited from interface org.refcodes.mixin.TypeAccessor
getType
-
Method Details
-
toStorageString
AColumnimplementation can provide its own text exchange format for the given objects. This method enables theColumnto convert a value of the given type to aStringand viafromStorageString(String)back to the value (bijective). This method supports data sinks (such as relational databases) which allow only a single value in a row's entry: In case T is an array type, then the storageStringrepresentation of the elements in that array are represented by a single returnedString. Question: Why does the detour through the methodtoStorageString(Object)not function?!? Having this snippet in the code seems to be fine for the compiler ... tryingtoStorageString_(Object)instead :-( In case a data sink (such as Amazon's SimpleDb) is to be addressed which provides dedicated support for multiple values in one row's entry, then the methodtoStorageStrings(Object)may be used instead. -
toStorageString_
AColumnimplementation can provide its own text exchange format for the given objects. This method enables theColumnto convert a value of the given type to aStringand viafromStorageString(String)back to the value (bijective). This method supports data sinks (such as relational databases) which allow only a single value in a row's entry: In case T is an array type, then the storageStringrepresentation of the elements in that array are represented by a single returnedString. In case a data sink (such as Amazon's SimpleDb) is to be addressed which provides dedicated support for multiple values in one row's entry, then the methodtoStorageStrings(Object)may be used instead. Question: Why does the detour through the methodtoStorageString(Object)not function?!? Having this snippet in the code seems to be fine for the compiler ... tryingtoStorageString_(Object)instead :-(- Parameters:
aValue- the element to be converted to aString.- Returns:
- The
Stringrepresentation of the value. - Throws:
ClassCastException- - if the object is not null and is not assignable to the type T.
-
toStorageStrings
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 viafromStorageStrings(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 methodtoStorageString(Object)may be used instead. -
fromStorageString
AColumnimplementation can provide its own text exchange format for the given objects. This method enables theColumnto convert aStringvalue to a value of the given type and viatoStorageString(Object)back to theString(bijective). This method supports data sinks (such as relational databases) which allow only a single value in a row's entry: In case T is an array type, then the storageStringrepresentation of the elements in that array are represented by the single passedString. In case a data sink (such as Amazon's SimpleDb) is to be addressed which provides dedicated support for multiple values in one row's entry, then the methodfromStorageStrings(String[])may be used instead.- Parameters:
aStringValue- The value to be converted to a type instance.- Returns:
- The type representation of the value.
- Throws:
ParseException- in case parsing theStringwas not possible
-
fromStorageStrings
AColumnimplementation can provide its own text exchange format for the given objects. This method enables theColumnto convert aStringarray value to a value of the given type and viatoStorageStrings(Object)back to theStringarray (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 providedStringarray. In case T is not an array type then the passedStringarray 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 methodfromStorageString(String)may be used instead.- Parameters:
aStringArray- The value to be converted to a type instance.- Returns:
- The type representation of the value.
- Throws:
ParseException- in case parsing theStringwas not possible
-
toPrintable
AColumnimplementation can provide its own printable format of the given objects; for example a human readable text representation of the value (or in very https://www.metacodes.proized cases even enriched with ANSI escape codes). This method enables theColumnto convert a value of the given type to a human readable text. The human readable text, in comparison to the methodObject.toString()(ortoStorageString(Object)) is not intended to be converted back to the actual value (not bijective). This method may be used aHeaderinstance's methodHeaderRow.toPrintable(Record).- Parameters:
aValue- the element to be converted to a human readable text.- Returns:
- The human readable representation of the value.
-
contains
Tests whether theRecordcontains a value identified by theColumninstance's key and where the value's type is assignable to theColumninstance's type. Only if them both criteria match, then true is returned. False is returned if there is no such value or the value is not assignable to theColumninstance's type.- Parameters:
aRecord- TheRecordwhich to test if there is a value associated to theColumninstance's key and if it can be casted to theColumninstance's type.- Returns:
- True in case the
Recordcontains a value identified by theColumninstance's key and where the value's type is assignable to theColumninstance's type.
-
get
Retrieves a type correct value from theRecordidentified by theColumninstance's key. In case the type of theColumninstance does not match the value's type associated with theColumninstance's key, then aColumnMismatchExceptionis thrown.- Parameters:
aRecord- TheRecordfrom which to retrieve the value associated to theColumninstances key.- Returns:
- The value from the
Recordassociated to theColumninstances key. - Throws:
ColumnMismatchException- in case the value in theRecordassociated with theColumninstance's key does not fit theColumninstance's type.
-
remove
Removes an entry (key and value pair) from the providedRecordmatching the key and the type of theColumn.- Parameters:
aRecord- TheRecordfrom which to remove the related entry.- Returns:
- The value related to the given
Columninstance's key or null if there was none such value found. - Throws:
ColumnMismatchException- in case the value in theRecordassociated with theColumninstance's key does not fit theColumninstance's type.
-
getValue
-