Interface Column
- All Known Implementing Classes:
ColumnAccessorBasedColumn,ColumnHolderRACColumn,ConstantObjectColumn,DoubleArrayColumn,IntArrayColumn,LimitedColumn,LongArrayColumn,NullColumn,ObjectArrayColumn
public interface Column
An interface representing a Column of data.
This interface prescribes that a
ColumnAccessor must be defined on the column, but also offers an
as(java.lang.Class<? extends T>) method to allow for optimized specific implementations of semantically meaningful logic.
That is, the expectation is that some things work with Column objects might choose to first ask the Column
object to become some other interface. If the Column knows how to do a good job as the requested interface, it can
return its own concrete implementation of the interface and run the necessary logic in its own optimized fashion.
If the Column instance does not know how to implement the semantic interface, it is expected that the
ColumnAccessor will be leveraged to implement whatever logic is required.-
Method Summary
Modifier and TypeMethodDescription<T> TAsks the Column to return itself as a concrete implementation of a specific interface.Returns the column as aColumnAccessor.
-
Method Details
-
toAccessor
Returns the column as aColumnAccessor. Semantically, this would be equivalent to callingColumn.as(ColumnAccessor.class). However, being able to implement this interface is part of the explicit contract of implementing this interface, so instead of relying onas(java.lang.Class<? extends T>)which allows for returning null, we define a top-level method that should never return null.- Returns:
- a
ColumnAccessorrepresentation of the column, this should never return null.
-
as
Asks the Column to return itself as a concrete implementation of a specific interface. The interface asked for will tend to be a semantically-meaningful interface. This method allows the calling code to interrogate the Column object about whether it can offer a meaningful optimization of the semantic interface. If a Column cannot do anything specifically optimal for the interface requested, it should return null instead of trying to come up with its own default implementation.- Type Parameters:
T- The interface that the calling code wants a concrete implementation of- Parameters:
clazz- A class object representing the interface that the calling code wants a concrete implementation of- Returns:
- A concrete implementation of the interface, or null if there is no meaningful optimization to be had through a local implementation of the interface.
-