Class ColumnAccessorBasedColumn
- java.lang.Object
-
- org.apache.druid.query.rowsandcols.column.ColumnAccessorBasedColumn
-
-
Constructor Summary
Constructors Constructor Description ColumnAccessorBasedColumn(ColumnAccessor base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
as(Class<? extends T> clazz)
Asks the Column to return itself as a concrete implementation of a specific interface.ColumnAccessor
toAccessor()
Returns the column as aColumnAccessor
.
-
-
-
Constructor Detail
-
ColumnAccessorBasedColumn
public ColumnAccessorBasedColumn(ColumnAccessor base)
-
-
Method Detail
-
toAccessor
@Nonnull public ColumnAccessor toAccessor()
Description copied from interface:Column
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 onColumn.as(java.lang.Class<? extends T>)
which allows for returning null, we define a top-level method that should never return null.- Specified by:
toAccessor
in interfaceColumn
- Returns:
- a
ColumnAccessor
representation of the column, this should never return null.
-
as
@Nullable public <T> T as(Class<? extends T> clazz)
Description copied from interface:Column
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.- Specified by:
as
in interfaceColumn
- 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.
-
-